From 719309ac5dd0bd875bb1854f291785c1efc16400 Mon Sep 17 00:00:00 2001 From: Martin Nagy Date: Fri, 13 Feb 2009 10:47:27 +0100 Subject: Add a convenience macro for isc_mem_put(). --- util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/util.h b/util.h index 18b37d7..5b40a33 100644 --- a/util.h +++ b/util.h @@ -48,4 +48,14 @@ #define ZERO_PTR(ptr) memset((ptr), 0, sizeof(*(ptr))) +#define SAFE_MEM_PUT(m, target_ptr, target_size) \ + do { \ + if ((target_ptr) != NULL) \ + isc_mem_put((m), (target_ptr), \ + (target_size)); \ + } while (0) + +#define SAFE_MEM_PUT_PTR(m, target_ptr) \ + SAFE_MEM_PUT((m), (target_ptr), sizeof(*(target_ptr))) + #endif /* !_LD_UTIL_H_ */ -- cgit