W3C home > Mailing lists > Public > www-lib@w3.org > July to September 2000

Patch for the HTArray_firstObject() macro

From: Wayne Davison <wayne@clari.net>
Date: Sun, 6 Aug 2000 20:55:16 -0700 (PDT)
To: www-lib@w3.org
Message-ID: <Pine.GSO.4.21.0008062042310.28030-100000@house.clari.net>
Back on March 2nd, I sent in a patch for the HTArray_firstObject()
macro that was not applied to the code.  Here it is again (with a
slightly enhanced explanation).

The HTArray_firstObject() macro is defined such that if the caller
doesn't pass in a variable named exactly "data" as the second
parameter, there will either be a syntax error generated during the
compilation OR the wrong structure element will get referenced.
This is because the macro argument "data" is the same name as the
HTArray structure element that is being referenced in the macro.

I suggest changing the macro argument from "data" to "dp".  Here's a
patch for the HTArray.html file:

--- HTArray.html      1998/05/14 02:10:14     2.7
+++ HTArray.html      2000/03/02 22:43:41
@@ -82,10 +82,10 @@
 Fast macros to traverse a macro ending in a NULL element.
-#define HTArray_firstObject(me, data) \
-	((me) &amp;&amp; ((data)=(me)-&gt;data) ? *(data)++ : NULL)
-#define HTArray_nextObject(me, data) \
-	((me) &amp;&amp; (data) ? *(data)++ : NULL)
+#define HTArray_firstObject(me, dp) \
+	((me) &amp;&amp; ((dp)=(me)-&gt;data) ? *(dp)++ : NULL)
+#define HTArray_nextObject(me, dp) \
+	((me) &amp;&amp; (dp) ? *(dp)++ : NULL)
 <H2>Sort an Array</H2>

Received on Sunday, 6 August 2000 23:55:26 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:53 UTC