From b51ef0eea028c73b6379e832eaa34fff3fbbb927 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 14 Sep 2011 17:36:57 +0100 Subject: Add context to mupdf. Huge pervasive change to lots of files, adding a context for exception handling and allocation. In time we'll move more statics into there. Also fix some for(i = 0; i < function(...); i++) calls. --- apps/x11_main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'apps/x11_main.c') diff --git a/apps/x11_main.c b/apps/x11_main.c index d719abda..f0f4f66d 100644 --- a/apps/x11_main.c +++ b/apps/x11_main.c @@ -554,6 +554,7 @@ int main(int argc, char **argv) fd_set fds; int width = -1; int height = -1; + fz_context *ctx; while ((c = fz_getopt(argc, argv, "p:r:b:A")) != -1) { @@ -583,9 +584,16 @@ int main(int argc, char **argv) if (accelerate) fz_accelerate(); + ctx = fz_context_init(&fz_alloc_default); + if (ctx == NULL) + { + fprintf(stderr, "failed to initialise context"); + exit(1); + } + winopen(); - pdfapp_init(&gapp); + pdfapp_init(ctx, &gapp); gapp.scrw = DisplayWidth(xdpy, xscr); gapp.scrh = DisplayHeight(xdpy, xscr); gapp.resolution = resolution; @@ -742,5 +750,7 @@ int main(int argc, char **argv) XCloseDisplay(xdpy); + fz_context_fin(ctx); + return 0; } -- cgit v1.2.3