From 357ea3fc88d43fb5a9c373bbcf1ad73b79f718e2 Mon Sep 17 00:00:00 2001 From: Bill Meier Date: Tue, 4 Dec 2012 14:37:21 +0000 Subject: Define variants of CLEANUP_PUSH & etc to allow nested use w/o "shadowing" variables. svn path=/trunk/; revision=46366 --- epan/except.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'epan/except.h') diff --git a/epan/except.h b/epan/except.h index 407be9d83c..68fa58e7fc 100644 --- a/epan/except.h +++ b/epan/except.h @@ -143,6 +143,29 @@ extern void except_free(void *); except_cl.except_func(except_cl.except_context); \ } + +/* --- Variants to allow nesting of except_cleanup_push w/o "shadowing" variables */ +#define except_cleanup_push_pfx(pfx, F, C) \ + { \ + struct except_stacknode pfx##_except_sn; \ + struct except_cleanup pfx##_except_cl; \ + except_setup_clean(&pfx##_except_sn, &pfx##_except_cl, F, C) + +#define except_cleanup_pop_pfx(pfx, E) \ + except_pop(); \ + if (E) \ + pfx##_except_cl.except_func(pfx##_except_cl.except_context);\ + } + +#define except_checked_cleanup_pop_pfx(pfx, F, E) \ + except_pop(); \ + assert (pfx##_except_cl.except_func == (F)); \ + if (E) \ + pfx##_except_cl.except_func(pfx##_except_cl.except_context);\ + } +/* ---------- */ + + #define except_try_push(ID, NUM, PPE) \ { \ struct except_stacknode except_sn; \ -- cgit v1.2.3