summaryrefslogtreecommitdiff
path: root/fitz/fitz.h
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2011-10-04 20:10:13 +0100
committerRobin Watts <Robin.Watts@artifex.com>2011-10-04 20:10:13 +0100
commit0a31674b1e78930e86d4d7408082f564bc550cf7 (patch)
treeeb570a3a79d3d4c51c1152a253dd35cf82e026ee /fitz/fitz.h
parent1cc3bf432a6d94e6f8411b55ee0f591d098f2062 (diff)
downloadmupdf-0a31674b1e78930e86d4d7408082f564bc550cf7.tar.xz
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.
Diffstat (limited to 'fitz/fitz.h')
-rw-r--r--fitz/fitz.h3
1 files changed, 2 insertions, 1 deletions
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 \