mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2024-12-29 07:19:42 +08:00
protobuf-c.c: wrap DO_ALLOC macro in a do {} while(0) statement
This commit is contained in:
parent
3ec5aa1256
commit
5b3ac9ca97
@ -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. */
|
/* Try to allocate memory, running some special code if it fails. */
|
||||||
#define DO_ALLOC(dst, allocator, size, fail_code) \
|
#define DO_ALLOC(dst, allocator, size, fail_code) \
|
||||||
|
do \
|
||||||
{ size_t da__allocation_size = (size); \
|
{ size_t da__allocation_size = (size); \
|
||||||
if (da__allocation_size == 0) \
|
if (da__allocation_size == 0) \
|
||||||
dst = NULL; \
|
dst = NULL; \
|
||||||
@ -101,7 +102,7 @@ alloc_failed_warning (unsigned size, const char *filename, unsigned line)
|
|||||||
alloc_failed_warning (da__allocation_size, __FILE__, __LINE__); \
|
alloc_failed_warning (da__allocation_size, __FILE__, __LINE__); \
|
||||||
fail_code; \
|
fail_code; \
|
||||||
} \
|
} \
|
||||||
}
|
} while(0)
|
||||||
#define DO_UNALIGNED_ALLOC DO_ALLOC /* placeholder */
|
#define DO_UNALIGNED_ALLOC DO_ALLOC /* placeholder */
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user