summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-02-29 20:18:39 +0000
committerRobin Watts <robin.watts@artifex.com>2012-02-29 20:18:39 +0000
commit4a80adff52b8f4fc4f7f0aba8d3583953ddde824 (patch)
tree15c47ae249b605cae6c2574af277d07583d5d928 /fitz
parentb8404ff187a63151b00acb4635e88aea444c10cf (diff)
downloadmupdf-4a80adff52b8f4fc4f7f0aba8d3583953ddde824.tar.xz
On MacOS/iOS use _setjmp/_longjmp rather than setjmp/longjmp.
On Apple OSs setjmp/longjmp also mess with the signal handlers; we don't use signals, so we don't need the slowdown this causes. CLUSTER_UNTESTED as not tested on cluster.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/base_error.c2
-rw-r--r--fitz/fitz.h14
2 files changed, 12 insertions, 4 deletions
diff --git a/fitz/base_error.c b/fitz/base_error.c
index 6b54fb69..f3ca4efa 100644
--- a/fitz/base_error.c
+++ b/fitz/base_error.c
@@ -46,7 +46,7 @@ void fz_warn(fz_context *ctx, char *fmt, ...)
static void throw(fz_error_context *ex)
{
if (ex->top >= 0) {
- longjmp(ex->stack[ex->top].buffer, 1);
+ fz_longjmp(ex->stack[ex->top].buffer, 1);
} else {
fprintf(stderr, "uncaught exception: %s\n", ex->message);
LOGE("uncaught exception: %s\n", ex->message);
diff --git a/fitz/fitz.h b/fitz/fitz.h
index e24d3fbb..0d0d657a 100644
--- a/fitz/fitz.h
+++ b/fitz/fitz.h
@@ -22,6 +22,14 @@
#include "memento.h"
+#ifdef __APPLE__
+#define fz_setjmp _setjmp
+#define fz_longjmp _longjmp
+#else
+#define fz_setjmp setjmp
+#define fz_longjmp longjmp
+#endif
+
#ifdef __ANDROID__
#include <android/log.h>
#define LOG_TAG "libmupdf"
@@ -143,7 +151,7 @@ void fz_var_imp(void *);
#define fz_try(ctx) \
if (fz_push_try(ctx->error), \
- (ctx->error->stack[ctx->error->top].code = setjmp(ctx->error->stack[ctx->error->top].buffer)) == 0) \
+ (ctx->error->stack[ctx->error->top].code = fz_setjmp(ctx->error->stack[ctx->error->top].buffer)) == 0) \
{ do {
#define fz_always(ctx) \
@@ -169,7 +177,7 @@ instead. This was held as too high a price to pay to drop limitation 2.
#define fz_try(ctx) \
if (fz_push_try(ctx->error), \
- (ctx->error->stack[ctx->error->top].code = setjmp(ctx->error->stack[ctx->error->top].buffer)) == 0) \
+ (ctx->error->stack[ctx->error->top].code = fz_setjmp(ctx->error->stack[ctx->error->top].buffer)) == 0) \
{ do {
#define fz_always_(ctx, label) \
@@ -197,7 +205,7 @@ execution. Again this was felt to be too high a cost to use.
#define fz_try(ctx) \
if (fz_push_try(ctx->error), \
- (ctx->error->stack[ctx->error->top].code = setjmp(ctx->error->stack[ctx->error->top].buffer)) == 0) \
+ (ctx->error->stack[ctx->error->top].code = fz_setjmp(ctx->error->stack[ctx->error->top].buffer)) == 0) \
{ do {
#define fz_always(ctx) \