summaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-06-17 18:22:39 +0000
committerNick Mathewson <nickm@torproject.org>2007-06-17 18:22:39 +0000
commit5adfa09fce2c61239f9a7fa5fb154282f802af0a (patch)
treeffd522053a544617737cc38128c2e315dce464b1 /src/or/buffers.c
parent93f32db438cff63662761374f4a69b710f3d71d9 (diff)
downloadtor-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/or/buffers.c')
-rw-r--r--src/or/buffers.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index eca603c263..9ddd014529 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -40,18 +40,21 @@ const char buffers_c_id[] =
/** Initialize the sentinel values on <b>m</b> (a value of buf-&gt;mem), which
* has <b>ln</b> useful bytes. */
#define SET_GUARDS(m, ln) \
- do { set_uint32((m)-4,START_MAGIC); set_uint32((m)+ln,END_MAGIC); } while (0)
+ STMT_BEGIN \
+ set_uint32((m)-4,START_MAGIC); \
+ set_uint32((m)+ln,END_MAGIC); \
+ STMT_END
#else
#define RAW_MEM(m) (m)
#define GUARDED_MEM(m) (m)
#define ALLOC_LEN(ln) (ln)
-#define SET_GUARDS(m,ln) do {} while (0)
+#define SET_GUARDS(m,ln) STMT_NIL
#endif
#ifdef PARANOIA
-#define check() do { assert_buf_ok(buf); } while (0)
+#define check() STMT_BEGIN assert_buf_ok(buf); STMT_END
#else
-#define check() do { } while (0)
+#define check() STMT_NIL
#endif
#ifdef NOINLINE