summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2013-02-14 14:52:42 +0100
committerLinus Nordberg <linus@nordberg.se>2013-02-14 14:52:42 +0100
commitb8f84e2abdf4c20c922a41cb4431013899b4212d (patch)
treec91282cd373c950e9bd78b7940e6978d45c087ad
parente6b0f4f404e06be4fdbf7a7cf5a475278ba3e587 (diff)
Parenthesise arguments to helper macros.
-rw-r--r--lib/include/radsec/radsec-impl.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/include/radsec/radsec-impl.h b/lib/include/radsec/radsec-impl.h
index ef01d70..32753ef 100644
--- a/lib/include/radsec/radsec-impl.h
+++ b/lib/include/radsec/radsec-impl.h
@@ -1,7 +1,8 @@
/** @file libradsec-impl.h
@brief Libraray internal header file for libradsec. */
-/* See LICENSE for licensing information. */
+/* Copyright 2010, 2011, 2013 NORDUnet A/S. All rights reserved.
+ See LICENSE for licensing information. */
#ifndef _RADSEC_RADSEC_IMPL_H_
#define _RADSEC_RADSEC_IMPL_H_ 1
@@ -141,14 +142,14 @@ struct rs_message {
#endif
/* Convenience macros. */
-#define rs_calloc(h, nmemb, size) \
- (h->alloc_scheme.calloc ? h->alloc_scheme.calloc : calloc)(nmemb, size)
-#define rs_malloc(h, size) \
- (h->alloc_scheme.malloc ? h->alloc_scheme.malloc : malloc)(size)
-#define rs_free(h, ptr) \
- (h->alloc_scheme.free ? h->alloc_scheme.free : free)(ptr)
-#define rs_realloc(h, realloc, ptr, size) \
- (h->alloc_scheme.realloc ? h->alloc_scheme.realloc : realloc)(ptr, size)
+#define rs_calloc(h, nmemb, size) ((h)->alloc_scheme.calloc != NULL \
+ ? (h)->alloc_scheme.calloc : calloc)((nmemb), (size))
+#define rs_malloc(h, size) ((h)->alloc_scheme.malloc != NULL \
+ ? (h)->alloc_scheme.malloc : malloc)((size))
+#define rs_free(h, ptr) ((h)->alloc_scheme.free != NULL \
+ ? (h)->alloc_scheme.free : free)((ptr))
+#define rs_realloc(h, ptr, size) ((h)->alloc_scheme.realloc != NULL \
+ ? (h)->alloc_scheme.realloc : realloc)((ptr), (size))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))