From 0a31674b1e78930e86d4d7408082f564bc550cf7 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 4 Oct 2011 20:10:13 +0100 Subject: Establish 'break scope' within fz_try macro It is vital that no one returns from within fz_try. As such it's often necessary to jump out of an fz_try. This can mean using a label at the end of the fz_try section to goto. By introducing a "do { } while (0)" around the contents of the fz_try we allow people to 'break' (or 'continue') to get out neatly. --- fitz/fitz.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fitz/fitz.h') diff --git a/fitz/fitz.h b/fitz/fitz.h index 83eade3b..da39b04d 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -164,9 +164,10 @@ struct fz_error_context_s #define fz_try(ctx) \ if (fz_push_try(ctx->error), \ !setjmp(ctx->error->stack[ctx->error->top].buffer)) \ - { + { do { #define fz_catch(ctx) \ + } while(0); \ ctx->error->stack[ctx->error->top].failed = 0; \ } \ else \ -- cgit v1.2.3