summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Nagy <mnagy@redhat.com>2009-07-31 14:24:12 +0200
committerMartin Nagy <mnagy@redhat.com>2009-08-04 16:50:54 +0200
commitc81addd0760ab5d6f692358dc771432ec0cd91be (patch)
tree8da943ea2fb2698930ad285fa84b63d35801d5fb
parent573182aa22cda2c0c7d25b99f79e967d53813d28 (diff)
downloadldap_driver-c81addd0760ab5d6f692358dc771432ec0cd91be.tar.gz
ldap_driver-c81addd0760ab5d6f692358dc771432ec0cd91be.tar.xz
ldap_driver-c81addd0760ab5d6f692358dc771432ec0cd91be.zip
Add CHECK_NEXT() macro similar to CHECK()
The CHECK_NEXT() macro behaves exactly as the CHECK() macro, with the difference that it jumps to the 'next' label. This is useful if we need to cleanup after every loop cycle, but don't want to abort the whole function if error is found.
-rw-r--r--src/util.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/util.h b/src/util.h
index 0dd6ee3..82d6550 100644
--- a/src/util.h
+++ b/src/util.h
@@ -21,8 +21,17 @@
#define _LD_UTIL_H_
#define CHECK(op) \
- do { result = (op); \
- if (result != ISC_R_SUCCESS) goto cleanup; \
+ do { \
+ result = (op); \
+ if (result != ISC_R_SUCCESS) \
+ goto cleanup; \
+ } while (0)
+
+#define CHECK_NEXT(op) \
+ do { \
+ result = (op); \
+ if (result != ISC_R_SUCCESS) \
+ goto next; \
} while (0)
#define CHECKED_MEM_ALLOCATE(m, target_ptr, s) \