diff options
author | Robin Watts <robin.watts@artifex.com> | 2011-12-16 16:26:48 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2011-12-16 16:26:48 +0000 |
commit | 09a016ee7c5c81580b27db3bd193b38cb3bd4f0e (patch) | |
tree | 90d0fad103f7aa592451f493a3d091ca9db7c866 /fitz/res_font.c | |
parent | 1f8cccdeca9cf9082061b40d66fc8201c8b3ce80 (diff) | |
download | mupdf-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 'fitz/res_font.c')
-rw-r--r-- | fitz/res_font.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fitz/res_font.c b/fitz/res_font.c index 60374746..38d6fdf1 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -11,7 +11,7 @@ fz_new_font(fz_context *ctx, char *name) { fz_font *font; - font = fz_malloc(ctx, sizeof(fz_font)); + font = fz_malloc_struct(ctx, fz_font); font->refs = 1; if (name) @@ -124,7 +124,7 @@ struct ft_error void fz_new_font_context(fz_context *ctx) { - ctx->font = fz_malloc(ctx, sizeof(*ctx->font)); + ctx->font = fz_malloc_struct(ctx, fz_font_context); ctx->font->ftlib = NULL; ctx->font->ftlib_refs = 0; } |