W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2006

Patch: fix gcc warnings

From: Sam Varshavchik <mrsam@courier-mta.com>
Date: Wed, 04 Jan 2006 21:48:20 -0500
Message-ID: <cone.1136429300.335888.6969.500@commodore.email-scan.com>
To: www-lib@w3.org

gcc is smart enough to figure out that HTAssoc_name() may potentially return 
a NULL, which is a no-no argument to strcmp().

Unfortunately, gcc isn't smart enough to figure out that the NULL codepath 
can never occur, and optimize it away.  Instead, it whines no less than a 
dozen times, in a row.


Index: Library/src/HTAssoc.c
===================================================================
RCS file: /cvsroot/lpmtool/libwww/Library/src/HTAssoc.c,v
retrieving revision 1.1.1.1
diff -U3 -r1.1.1.1 HTAssoc.c
--- Library/src/HTAssoc.c	5 Jan 2006 01:08:49 -0000	1.1.1.1
+++ Library/src/HTAssoc.c	5 Jan 2006 02:46:16 -0000
@@ -129,7 +129,7 @@
 	HTAssocList * cur = list;
 	HTAssoc * assoc;
 	while ((assoc = (HTAssoc *) HTAssocList_nextObject(cur))) {
-	    if (!strcmp(HTAssoc_name(assoc), name))
+	    if (!strcmp(assoc->name, name))
 		return HTAssoc_value(assoc);
 	}
     }


Received on Thursday, 5 January 2006 02:48:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:45 GMT