Patch for the HTArray_firstObject() macro

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.
 
 <PRE>
-#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)
 </PRE>
 
 <H2>Sort an Array</H2>

..wayne..

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