summaryrefslogtreecommitdiff
path: root/pdf/pdf_colorspace.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-12-16 16:26:48 +0000
committerRobin Watts <robin.watts@artifex.com>2011-12-16 16:26:48 +0000
commit09a016ee7c5c81580b27db3bd193b38cb3bd4f0e (patch)
tree90d0fad103f7aa592451f493a3d091ca9db7c866 /pdf/pdf_colorspace.c
parent1f8cccdeca9cf9082061b40d66fc8201c8b3ce80 (diff)
downloadmupdf-09a016ee7c5c81580b27db3bd193b38cb3bd4f0e.tar.xz
Add fz_malloc_struct, and make code use it.
The new fz_malloc_struct(A,B) macro allocates sizeof(B) bytes using fz_malloc, and then passes the resultant pointer to Memento_label to label it with "B". This costs nothing in non-memento builds, but gives much nicer listings of leaked blocks when memento is enabled.
Diffstat (limited to 'pdf/pdf_colorspace.c')
-rw-r--r--pdf/pdf_colorspace.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pdf/pdf_colorspace.c b/pdf/pdf_colorspace.c
index 9edc1e90..0efcd13a 100644
--- a/pdf/pdf_colorspace.c
+++ b/pdf/pdf_colorspace.c
@@ -118,7 +118,7 @@ load_separation(pdf_xref *xref, fz_obj *array)
/* RJW: fz_drop_colorspace(ctx, base);
* "cannot load tint function (%d %d R)", fz_to_num(tintobj), fz_to_gen(tintobj) */
- sep = fz_malloc(ctx, sizeof(struct separation));
+ sep = fz_malloc_struct(ctx, struct separation);
sep->base = base;
sep->tint = tint;
@@ -218,7 +218,7 @@ load_indexed(pdf_xref *xref, fz_obj *array)
base = pdf_load_colorspace(xref, baseobj);
/* "cannot load base colorspace (%d %d R)", fz_to_num(baseobj), fz_to_gen(baseobj) */
- idx = fz_malloc(ctx, sizeof(struct indexed));
+ idx = fz_malloc_struct(ctx, struct indexed);
idx->base = base;
idx->high = fz_to_int(highobj);
idx->high = CLAMP(idx->high, 0, 255);