hal: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Tue Oct 10 21:43:37 PDT 2006


 hald/ids.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

New commits:
diff-tree b105ec345ad12fc4eff158c9aeaab78caebe9a71 (from 5e33459557cf9d4680f894392a834b7752acd60a)
Author: David Zeuthen <davidz at redhat.com>
Date:   Wed Oct 11 00:43:32 2006 -0400

    make pnp.ids static to save writable memory
    
    Goodbye another 8KB!

diff --git a/hald/ids.c b/hald/ids.c
index aa23e1c..223c8d4 100644
--- a/hald/ids.c
+++ b/hald/ids.c
@@ -527,9 +527,9 @@ ids_init (void)
  * Keep this sorted!
  */
 struct pnp_id {
-	char *id;
-   	char *desc;
-} static  pnp_ids_list[] = {
+	const char *id;
+   	const char *desc;
+} static const pnp_ids_list[] = {
 	/* Crystal Semiconductor devices */
 	{"CSC0000", "Crystal Semiconductor CS423x sound -- SB/WSS/OPL3 emulation"},
 	{"CSC0001", "Crystal Semiconductor CS423x sound -- joystick"},
@@ -948,22 +948,14 @@ ids_comp_pnp(const void *id1, const void
 void
 ids_find_pnp (const char *pnp_id, char **pnp_description)
 {
-	static gboolean sorted = FALSE;
 	struct pnp_id search, *res;
-        
-	if (!sorted) {
-		/* sort the list, to be sure that all is in correc order */
-		qsort(pnp_ids_list, sizeof(pnp_ids_list)/sizeof(pnp_ids_list[0]), 
-		      sizeof(struct pnp_id), ids_comp_pnp);
-		sorted = TRUE;
-	}
 
         search.id = (char *) pnp_id;
         res = bsearch(&search, pnp_ids_list, sizeof(pnp_ids_list)/sizeof(pnp_ids_list[0]), 
 		      sizeof(struct pnp_id), ids_comp_pnp);
 
         if (res != NULL)
-        	*pnp_description = res->desc;
+        	*pnp_description = (char *) res->desc;
 	else
         	*pnp_description = NULL; 
         return;


More information about the hal-commit mailing list