summaryrefslogtreecommitdiff
path: root/fitz/dev_list.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 /fitz/dev_list.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 'fitz/dev_list.c')
-rw-r--r--fitz/dev_list.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fitz/dev_list.c b/fitz/dev_list.c
index 47e8b069..03c65f49 100644
--- a/fitz/dev_list.c
+++ b/fitz/dev_list.c
@@ -70,7 +70,7 @@ fz_new_display_node(fz_context *ctx, fz_display_command cmd, fz_matrix ctm,
fz_display_node *node;
int i;
- node = fz_malloc(ctx, sizeof(fz_display_node));
+ node = fz_malloc_struct(ctx, fz_display_node);
node->cmd = cmd;
node->next = NULL;
node->rect = fz_empty_rect;
@@ -99,7 +99,7 @@ fz_new_display_node(fz_context *ctx, fz_display_command cmd, fz_matrix ctm,
static fz_stroke_state *
fz_clone_stroke_state(fz_context *ctx, fz_stroke_state *stroke)
{
- fz_stroke_state *newstroke = fz_malloc(ctx, sizeof(fz_stroke_state));
+ fz_stroke_state *newstroke = fz_malloc_struct(ctx, fz_stroke_state);
*newstroke = *stroke;
return newstroke;
}
@@ -482,7 +482,7 @@ fz_new_list_device(fz_context *ctx, fz_display_list *list)
fz_display_list *
fz_new_display_list(fz_context *ctx)
{
- fz_display_list *list = fz_malloc(ctx, sizeof(fz_display_list));
+ fz_display_list *list = fz_malloc_struct(ctx, fz_display_list);
list->first = NULL;
list->last = NULL;
list->top = 0;