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/stm_open.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/stm_open.c')
-rw-r--r-- | fitz/stm_open.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fitz/stm_open.c b/fitz/stm_open.c index 733b4c6a..dfb4ed8d 100644 --- a/fitz/stm_open.c +++ b/fitz/stm_open.c @@ -7,7 +7,7 @@ fz_new_stream(fz_context *ctx, void *state, { fz_stream *stm; - stm = fz_malloc(ctx, sizeof(fz_stream)); + stm = fz_malloc_struct(ctx, fz_stream); stm->refs = 1; stm->error = 0; @@ -86,7 +86,7 @@ fz_open_fd(fz_context *ctx, int fd) fz_stream *stm; int *state; - state = fz_malloc(ctx, sizeof(int)); + state = fz_malloc_struct(ctx, int); *state = fd; fz_try(ctx) |