From ab770bef466d03bfcabef6d4429efc1e8d50557f Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 13 Jul 2016 18:11:03 +0100 Subject: Use fz_malloc_struct rather than fz_calloc. This helps with Memento debugging, and looks neater. --- source/pdf/pdf-resources.c | 6 +++--- source/pdf/pdf-xref.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/pdf/pdf-resources.c b/source/pdf/pdf-resources.c index 07fc873f..9b539fa9 100644 --- a/source/pdf/pdf-resources.c +++ b/source/pdf/pdf-resources.c @@ -202,10 +202,10 @@ pdf_init_resource_tables(fz_context *ctx, pdf_document *doc) { fz_try(ctx) { - doc->resources = fz_calloc(ctx, 1, sizeof(pdf_resource_tables)); - doc->resources->image = fz_calloc(ctx, 1, sizeof(pdf_res_table)); + doc->resources = fz_malloc_struct(ctx, pdf_resource_tables); + doc->resources->image = fz_malloc_struct(ctx, pdf_res_table); doc->resources->image->search = res_image_search; - doc->resources->font = fz_calloc(ctx, 1, sizeof(pdf_res_table)); + doc->resources->font = fz_malloc_struct(ctx, pdf_res_table); doc->resources->font->search = res_font_search; } fz_catch(ctx) diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index f9f2f576..01b72d04 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -210,7 +210,7 @@ pdf_xref_entry *pdf_get_populating_xref_entry(fz_context *ctx, pdf_document *doc if (doc->num_xref_sections == 0) { - doc->xref_sections = fz_calloc(ctx, 1, sizeof(pdf_xref)); + doc->xref_sections = fz_malloc_struct(ctx, pdf_xref); doc->num_xref_sections = 1; } @@ -1365,7 +1365,7 @@ pdf_read_ocg(fz_context *ctx, pdf_document *doc) len = pdf_array_len(ctx, ocg); fz_try(ctx) { - desc = fz_calloc(ctx, 1, sizeof(*desc)); + desc = fz_malloc_struct(ctx, pdf_ocg_descriptor); desc->len = len; desc->ocgs = fz_calloc(ctx, len, sizeof(*desc->ocgs)); desc->intent = NULL; -- cgit v1.2.3