summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-09-21 15:01:36 +0200
committerTor Andersson <tor.andersson@artifex.com>2011-09-21 15:01:36 +0200
commitaa7668835afffd5a2a496a60ed6edb672f5af1a7 (patch)
tree92bc58eb4ee9d4f3b30f9b9919aa148b1e330471 /apps
parent69ed4a8f4dbfac7f2f1de925e34807e4fee3b27c (diff)
downloadmupdf-aa7668835afffd5a2a496a60ed6edb672f5af1a7.tar.xz
Rename malloc functions for arrays (fz_calloc and fz_realloc).
Diffstat (limited to 'apps')
-rw-r--r--apps/pdfclean.c12
-rw-r--r--apps/pdfdraw.c2
-rw-r--r--apps/pdfextract.c2
-rw-r--r--apps/pdfinfo.c16
-rw-r--r--apps/pdfshow.c2
-rw-r--r--apps/x11_main.c2
-rw-r--r--apps/xpsdraw.c2
7 files changed, 19 insertions, 19 deletions
diff --git a/apps/pdfclean.c b/apps/pdfclean.c
index 302970bc..a1e70a1a 100644
--- a/apps/pdfclean.c
+++ b/apps/pdfclean.c
@@ -251,7 +251,7 @@ static void renumberobjs(void)
/* Create new table for the reordered, compacted xref */
oldxref = xref->table;
- xref->table = fz_calloc(xref->ctx, xref->len, sizeof(pdf_xref_entry));
+ xref->table = fz_malloc_array(xref->ctx, xref->len, sizeof(pdf_xref_entry));
xref->table[0] = oldxref[0];
/* Move used objects into the new compacted xref */
@@ -720,7 +720,7 @@ int main(int argc, char **argv)
if (argc - fz_optind > 0)
subset = 1;
- ctx = fz_new_context(&fz_alloc_default);
+ ctx = fz_new_context();
if (ctx == NULL)
die(fz_error_note(1, "failed to initialise context"));
@@ -735,10 +735,10 @@ int main(int argc, char **argv)
fprintf(out, "%%PDF-%d.%d\n", xref->version / 10, xref->version % 10);
fprintf(out, "%%\316\274\341\277\246\n\n");
- uselist = fz_calloc(ctx, xref->len + 1, sizeof(char));
- ofslist = fz_calloc(ctx, xref->len + 1, sizeof(int));
- genlist = fz_calloc(ctx, xref->len + 1, sizeof(int));
- renumbermap = fz_calloc(ctx, xref->len + 1, sizeof(int));
+ uselist = fz_malloc_array(ctx, xref->len + 1, sizeof(char));
+ ofslist = fz_malloc_array(ctx, xref->len + 1, sizeof(int));
+ genlist = fz_malloc_array(ctx, xref->len + 1, sizeof(int));
+ renumbermap = fz_malloc_array(ctx, xref->len + 1, sizeof(int));
for (num = 0; num < xref->len; num++)
{
diff --git a/apps/pdfdraw.c b/apps/pdfdraw.c
index 2c2e476b..a088a938 100644
--- a/apps/pdfdraw.c
+++ b/apps/pdfdraw.c
@@ -343,7 +343,7 @@ int main(int argc, char **argv)
if (accelerate)
fz_accelerate();
- ctx = fz_new_context(&fz_alloc_default);
+ ctx = fz_new_context();
if (ctx == NULL)
{
fprintf(stderr, "Failed to init context\n");
diff --git a/apps/pdfextract.c b/apps/pdfextract.c
index 490a8c1e..f59f7df8 100644
--- a/apps/pdfextract.c
+++ b/apps/pdfextract.c
@@ -198,7 +198,7 @@ int main(int argc, char **argv)
infile = argv[fz_optind++];
- ctx = fz_new_context(&fz_alloc_default);
+ ctx = fz_new_context();
if (ctx == NULL)
die(fz_error_note(1, "failed to initialise context"));
diff --git a/apps/pdfinfo.c b/apps/pdfinfo.c
index cf81105c..3e403b08 100644
--- a/apps/pdfinfo.c
+++ b/apps/pdfinfo.c
@@ -224,7 +224,7 @@ gatherdimensions(int page, fz_obj *pageref, fz_obj *pageobj)
dims++;
- dim = fz_realloc(ctx, dim, dims * sizeof(struct info));
+ dim = fz_resize_array(ctx, dim, dims, sizeof(struct info));
dim[dims - 1].page = page;
dim[dims - 1].pageref = pageref;
dim[dims - 1].pageobj = pageobj;
@@ -269,7 +269,7 @@ gatherfonts(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
fonts++;
- font = fz_realloc(ctx, font, fonts * sizeof(struct info));
+ font = fz_resize_array(ctx, font, fonts, sizeof(struct info));
font[fonts - 1].page = page;
font[fonts - 1].pageref = pageref;
font[fonts - 1].pageobj = pageobj;
@@ -338,7 +338,7 @@ gatherimages(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
images++;
- image = fz_realloc(ctx, image, images * sizeof(struct info));
+ image = fz_resize_array(ctx, image, images, sizeof(struct info));
image[images - 1].page = page;
image[images - 1].pageref = pageref;
image[images - 1].pageobj = pageobj;
@@ -396,7 +396,7 @@ gatherforms(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
forms++;
- form = fz_realloc(ctx, form, forms * sizeof(struct info));
+ form = fz_resize_array(ctx, form, forms, sizeof(struct info));
form[forms - 1].page = page;
form[forms - 1].pageref = pageref;
form[forms - 1].pageobj = pageobj;
@@ -441,7 +441,7 @@ gatherpsobjs(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
psobjs++;
- psobj = fz_realloc(ctx, psobj, psobjs * sizeof(struct info));
+ psobj = fz_resize_array(ctx, psobj, psobjs, sizeof(struct info));
psobj[psobjs - 1].page = page;
psobj[psobjs - 1].pageref = pageref;
psobj[psobjs - 1].pageobj = pageobj;
@@ -484,7 +484,7 @@ gathershadings(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
shadings++;
- shading = fz_realloc(ctx, shading, shadings * sizeof(struct info));
+ shading = fz_resize_array(ctx, shading, shadings, sizeof(struct info));
shading[shadings - 1].page = page;
shading[shadings - 1].pageref = pageref;
shading[shadings - 1].pageobj = pageobj;
@@ -552,7 +552,7 @@ gatherpatterns(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
patterns++;
- pattern = fz_realloc(ctx, pattern, patterns * sizeof(struct info));
+ pattern = fz_resize_array(ctx, pattern, patterns, sizeof(struct info));
pattern[patterns - 1].page = page;
pattern[patterns - 1].pageref = pageref;
pattern[patterns - 1].pageobj = pageobj;
@@ -981,7 +981,7 @@ int main(int argc, char **argv)
if (fz_optind == argc)
infousage();
- ctx = fz_new_context(&fz_alloc_default);
+ ctx = fz_new_context();
if (ctx == NULL)
die(fz_error_make("failed to initialise context"));
diff --git a/apps/pdfshow.c b/apps/pdfshow.c
index 0fd49010..fc391b58 100644
--- a/apps/pdfshow.c
+++ b/apps/pdfshow.c
@@ -214,7 +214,7 @@ int main(int argc, char **argv)
filename = argv[fz_optind++];
- ctx = fz_new_context(&fz_alloc_default);
+ ctx = fz_new_context();
if (ctx == NULL)
die(fz_error_note(1, "failed to initialise context"));
diff --git a/apps/x11_main.c b/apps/x11_main.c
index a8c92074..d5b7dc55 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -584,7 +584,7 @@ int main(int argc, char **argv)
if (accelerate)
fz_accelerate();
- ctx = fz_new_context(&fz_alloc_default);
+ ctx = fz_new_context();
if (ctx == NULL)
{
fprintf(stderr, "failed to initialise context");
diff --git a/apps/xpsdraw.c b/apps/xpsdraw.c
index 719719ea..2ec54322 100644
--- a/apps/xpsdraw.c
+++ b/apps/xpsdraw.c
@@ -311,7 +311,7 @@ int main(int argc, char **argv)
if (accelerate)
fz_accelerate();
- fzctx = fz_new_context(&fz_alloc_default);
+ fzctx = fz_new_context();
if (fzctx == NULL)
{
fprintf(stderr, "failed to initialise context");