[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r16815: {tor} Replace the dummy-use var in SMARTLIST_FOREACH_END() with on (tor/trunk/src/common)



Author: nickm
Date: 2008-09-09 15:29:33 -0400 (Tue, 09 Sep 2008)
New Revision: 16815

Modified:
   tor/trunk/src/common/container.h
Log:
Replace the dummy-use var in SMARTLIST_FOREACH_END() with one that is less likely to confuse analysis tools into thinking we do use after free.  Arguably, (void)x should count as use in suppressing unused variable warnings, but not in generating hey-you-used-a-variable warnings.  Arguably, though, it shouldn't.

Modified: tor/trunk/src/common/container.h
===================================================================
--- tor/trunk/src/common/container.h	2008-09-09 16:33:48 UTC (rev 16814)
+++ tor/trunk/src/common/container.h	2008-09-09 19:29:33 UTC (rev 16815)
@@ -204,7 +204,7 @@
       var = (sl)->list[var ## _sl_idx];
 
 #define SMARTLIST_FOREACH_END(var)              \
-    (void)var;                                  \
+    var = NULL;                                 \
   } STMT_END
 
 #define SMARTLIST_FOREACH(sl, type, var, cmd)                   \