summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/pdfclean.c2
-rw-r--r--apps/pdfdraw.c2
-rw-r--r--apps/pdfextract.c2
-rw-r--r--apps/pdfinfo.c2
-rw-r--r--apps/pdfshow.c2
-rw-r--r--apps/win_main.c2
-rw-r--r--apps/x11_main.c2
-rw-r--r--apps/xpsdraw.c2
-rw-r--r--fitz/base_context.c5
-rw-r--r--ios/main.m2
10 files changed, 14 insertions, 9 deletions
diff --git a/apps/pdfclean.c b/apps/pdfclean.c
index 2e7aa732..ed149268 100644
--- a/apps/pdfclean.c
+++ b/apps/pdfclean.c
@@ -768,7 +768,7 @@ int main(int argc, char **argv)
if (argc - fz_optind > 0)
subset = 1;
- ctx = fz_new_context(&fz_alloc_default, 256<<20);
+ ctx = fz_new_context(NULL, 0);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/pdfdraw.c b/apps/pdfdraw.c
index cc125a69..ed10baa1 100644
--- a/apps/pdfdraw.c
+++ b/apps/pdfdraw.c
@@ -409,7 +409,7 @@ int main(int argc, char **argv)
if (accelerate)
fz_accelerate();
- ctx = fz_new_context(&fz_alloc_default, 256<<20);
+ ctx = fz_new_context(NULL, 0);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/pdfextract.c b/apps/pdfextract.c
index 486090e0..ef8383ad 100644
--- a/apps/pdfextract.c
+++ b/apps/pdfextract.c
@@ -182,7 +182,7 @@ int main(int argc, char **argv)
infile = argv[fz_optind++];
- ctx = fz_new_context(&fz_alloc_default, 256<<20);
+ ctx = fz_new_context(NULL, 0);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/pdfinfo.c b/apps/pdfinfo.c
index 054f0985..c0f5c6c6 100644
--- a/apps/pdfinfo.c
+++ b/apps/pdfinfo.c
@@ -971,7 +971,7 @@ int main(int argc, char **argv)
if (fz_optind == argc)
infousage();
- ctx = fz_new_context(&fz_alloc_default, 256<<20);
+ ctx = fz_new_context(NULL, 0);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/pdfshow.c b/apps/pdfshow.c
index 300da9ca..ec2fedbd 100644
--- a/apps/pdfshow.c
+++ b/apps/pdfshow.c
@@ -198,7 +198,7 @@ int main(int argc, char **argv)
filename = argv[fz_optind++];
- ctx = fz_new_context(&fz_alloc_default, 256<<20);
+ ctx = fz_new_context(NULL, 0);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/win_main.c b/apps/win_main.c
index e04a5bf9..a618cf44 100644
--- a/apps/win_main.c
+++ b/apps/win_main.c
@@ -831,7 +831,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShow
fz_accelerate();
- ctx = fz_new_context(&fz_alloc_default, 256<<20);
+ ctx = fz_new_context(NULL, 0);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/x11_main.c b/apps/x11_main.c
index 7b50daa9..45c6fc49 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -587,7 +587,7 @@ int main(int argc, char **argv)
struct timeval tmo;
struct timeval *timeout;
- ctx = fz_new_context(&fz_alloc_default, 256<<20);
+ ctx = fz_new_context(NULL, 0);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/xpsdraw.c b/apps/xpsdraw.c
index 930185ae..04c43053 100644
--- a/apps/xpsdraw.c
+++ b/apps/xpsdraw.c
@@ -320,7 +320,7 @@ int main(int argc, char **argv)
if (accelerate)
fz_accelerate();
- ctx = fz_new_context(&fz_alloc_default, 256<<20);
+ ctx = fz_new_context(NULL, 0);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/fitz/base_context.c b/fitz/base_context.c
index ee92904b..218ce407 100644
--- a/fitz/base_context.c
+++ b/fitz/base_context.c
@@ -35,6 +35,11 @@ fz_new_context(fz_alloc_context *alloc, unsigned int max_store)
{
fz_context *ctx;
+ if (!alloc)
+ alloc = &fz_alloc_default;
+ if (max_store == 0)
+ max_store = 256 << 20;
+
ctx = alloc->malloc(alloc->user, sizeof(fz_context));
if (!ctx)
return NULL;
diff --git a/ios/main.m b/ios/main.m
index 3840fcad..612ca6b2 100644
--- a/ios/main.m
+++ b/ios/main.m
@@ -1386,7 +1386,7 @@ static UIImage *renderTile(struct document *doc, int number, CGSize screenSize,
queue = dispatch_queue_create("com.artifex.mupdf.queue", NULL);
// use at most 128M for resource cache
- ctx = fz_new_context(&fz_alloc_default, 128<<20);
+ ctx = fz_new_context(NULL, 128<<20);
glyphcache = fz_new_glyph_cache(ctx);