Patch: fix gcc warnings

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Patch: fix gcc warnings

Sam Varshavchik

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);
  }
     }


attachment0 (196 bytes) Download Attachment