From 5e80944c52ae8abb43a446272f202d8a7d8af083 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 15 Oct 2004 04:45:47 +0000 Subject: Use token-pasting magic to make nested SMARTLIST_FOREACH work. svn:r2526 --- src/common/util.h | 7 ++++--- 1 file 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) -- cgit v1.2.3-54-g00ecf