diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-10-15 04:45:47 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-10-15 04:45:47 +0000 |
commit | 5e80944c52ae8abb43a446272f202d8a7d8af083 (patch) | |
tree | 274f5de9c74d80339188e3d6f815e48214c07c9b | |
parent | ff38cc06e1f7466ed7c6a3524d9817e1c48a0de2 (diff) | |
download | tor-5e80944c52ae8abb43a446272f202d8a7d8af083.tar.gz tor-5e80944c52ae8abb43a446272f202d8a7d8af083.zip |
Use token-pasting magic to make nested SMARTLIST_FOREACH work.
svn:r2526
-rw-r--r-- | src/common/util.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/common/util.h b/src/common/util.h index 2155a3a06a..093fd73c1c 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -149,10 +149,11 @@ char *smartlist_join_strings(smartlist_t *sl, const char *join, int terminate); #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) |