From 5b3ac9ca97b65db650b255b534af768bc704fbcb Mon Sep 17 00:00:00 2001 From: Ilya Lipnitskiy Date: Mon, 2 Dec 2013 15:43:08 -0800 Subject: [PATCH] protobuf-c.c: wrap DO_ALLOC macro in a do {} while(0) statement --- protobuf-c/protobuf-c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protobuf-c/protobuf-c.c b/protobuf-c/protobuf-c.c index 4a870cd..9d25f93 100644 --- a/protobuf-c/protobuf-c.c +++ b/protobuf-c/protobuf-c.c @@ -92,6 +92,7 @@ alloc_failed_warning (unsigned size, const char *filename, unsigned line) /* Try to allocate memory, running some special code if it fails. */ #define DO_ALLOC(dst, allocator, size, fail_code) \ +do \ { size_t da__allocation_size = (size); \ if (da__allocation_size == 0) \ dst = NULL; \ @@ -101,7 +102,7 @@ alloc_failed_warning (unsigned size, const char *filename, unsigned line) alloc_failed_warning (da__allocation_size, __FILE__, __LINE__); \ fail_code; \ } \ -} +} while(0) #define DO_UNALIGNED_ALLOC DO_ALLOC /* placeholder */