From c81addd0760ab5d6f692358dc771432ec0cd91be Mon Sep 17 00:00:00 2001 From: Martin Nagy Date: Fri, 31 Jul 2009 14:24:12 +0200 Subject: 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. --- src/util.h | 13 +++++++++++-- 1 file 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) \ -- cgit