[or-cvs] Use token-pasting magic to make nested SMARTLIST_FOREACH wo...

Nick Mathewson nickm at seul.org
Fri Oct 15 04:45:49 UTC 2004


Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv21713/src/common

Modified Files:
	util.h 
Log Message:
Use token-pasting magic to make nested SMARTLIST_FOREACH work.

Index: util.h
===================================================================
RCS file: /home/or/cvsroot/src/common/util.h,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- util.h	14 Oct 2004 19:51:47 -0000	1.98
+++ util.h	15 Oct 2004 04:45:47 -0000	1.99
@@ -149,10 +149,11 @@
 
 #define SMARTLIST_FOREACH(sl, type, var, cmd)                   \
   do {                                                          \
-    int sl_idx, sl_len=smartlist_len(sl);                       \
+    int var ## _sl_idx, var ## _sl_len=smartlist_len(sl);       \
     type var;                                                   \
-    for(sl_idx = 0; sl_idx < sl_len; ++sl_idx) {                \
-      var = smartlist_get((sl),sl_idx);                         \
+    for(var ## _sl_idx = 0; var ## _sl_idx < var ## _sl_len;    \
+        ++var ## _sl_idx) {                                     \
+      var = smartlist_get((sl),var ## _sl_idx);                 \
       do {cmd;} while(0);                                       \
     } } while (0)
 



More information about the tor-commits mailing list