diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-06-17 18:22:39 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-06-17 18:22:39 +0000 |
commit | 5adfa09fce2c61239f9a7fa5fb154282f802af0a (patch) | |
tree | ffd522053a544617737cc38128c2e315dce464b1 /src/common/container.h | |
parent | 93f32db438cff63662761374f4a69b710f3d71d9 (diff) | |
download | tor-5adfa09fce2c61239f9a7fa5fb154282f802af0a.tar.gz tor-5adfa09fce2c61239f9a7fa5fb154282f802af0a.zip |
r13477@catbus: nickm | 2007-06-17 14:22:03 -0400
Sun CC likes to give warnings for the do { } while(0) construction for making statement-like macros. Define STMT_BEGIN/STMT_END macros that do the right thing, and use them everywhere.
svn:r10645
Diffstat (limited to 'src/common/container.h')
-rw-r--r-- | src/common/container.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/container.h b/src/common/container.h index 44ea81fa65..973bc38640 100644 --- a/src/common/container.h +++ b/src/common/container.h @@ -159,24 +159,24 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join, * </pre> */ #define SMARTLIST_FOREACH(sl, type, var, cmd) \ - do { \ + STMT_BEGIN \ int var ## _sl_idx, var ## _sl_len=(sl)->num_used; \ type var; \ for (var ## _sl_idx = 0; var ## _sl_idx < var ## _sl_len; \ ++var ## _sl_idx) { \ var = (sl)->list[var ## _sl_idx]; \ cmd; \ - } } while (0) + } STMT_END /** Helper: While in a SMARTLIST_FOREACH loop over the list <b>sl</b> indexed * with the variable <b>var</b>, remove the current element in a way that * won't confuse the loop. */ #define SMARTLIST_DEL_CURRENT(sl, var) \ - do { \ + STMT_BEGIN \ smartlist_del(sl, var ## _sl_idx); \ --var ## _sl_idx; \ --var ## _sl_len; \ - } while (0); + STMT_END #define DECLARE_MAP_FNS(maptype, keytype, prefix) \ typedef struct maptype maptype; \ |