summaryrefslogtreecommitdiff
path: root/pdf/pdf_function.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-12-08 14:24:33 +0000
committerRobin Watts <robin.watts@artifex.com>2011-12-08 14:24:33 +0000
commit0e6931ad400fbf2780bd06530a3135653f8c9b4f (patch)
tree392572d681660f3af0749f30f1102b42ff6d51c7 /pdf/pdf_function.c
parent31d174bb39bfbde8861882c128dafd383a8fed7d (diff)
downloadmupdf-0e6931ad400fbf2780bd06530a3135653f8c9b4f.tar.xz
Move from volatile to fz_var.
When using exceptions (which are implemented using setjmp/longjmp), we need to be careful to ensure that variable values get written back before any exception happens. Previously we've done that using volatile, but that produces nasty warnings (and unduly limits the compilers freedom to optimise). Here we introduce a new macro fz_var that passes the address of the variable out of scope. This means that the compiler has to ensure that any changes to its value are written back to memory before calling any out of scope function.
Diffstat (limited to 'pdf/pdf_function.c')
-rw-r--r--pdf/pdf_function.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/pdf/pdf_function.c b/pdf/pdf_function.c
index 3ef0d75f..82c29dfd 100644
--- a/pdf/pdf_function.c
+++ b/pdf/pdf_function.c
@@ -817,13 +817,15 @@ parse_code(pdf_function *func, fz_stream *stream, int *codeptr)
static void
load_postscript_func(pdf_function *func, pdf_xref *xref, fz_obj *dict, int num, int gen)
{
- fz_stream * volatile stream = NULL;
+ fz_stream *stream = NULL;
int codeptr;
char buf[64];
int tok;
int len;
fz_context *ctx = xref->ctx;
+ fz_var(stream);
+
fz_try(ctx)
{
stream = pdf_open_stream(xref, num, gen);
@@ -1328,7 +1330,7 @@ pdf_function *
pdf_load_function(pdf_xref *xref, fz_obj *dict)
{
fz_context *ctx = xref->ctx;
- pdf_function * volatile func;
+ pdf_function *func;
fz_obj *obj;
int i;