summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Nagy <mnagy@redhat.com>2009-02-13 10:47:27 +0100
committerMartin Nagy <mnagy@redhat.com>2009-02-18 18:20:42 +0100
commit719309ac5dd0bd875bb1854f291785c1efc16400 (patch)
tree7029ac20c27ba4bc2243dae19b8335f24b505d64
parent0755ae502284671fc8345781d3409e406d9e39ab (diff)
downloadldap_driver_testing-719309ac5dd0bd875bb1854f291785c1efc16400.tar.gz
ldap_driver_testing-719309ac5dd0bd875bb1854f291785c1efc16400.tar.xz
ldap_driver_testing-719309ac5dd0bd875bb1854f291785c1efc16400.zip
Add a convenience macro for isc_mem_put().
-rw-r--r--util.h10
1 files changed, 10 insertions, 0 deletions
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_ */