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/filt_basic.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/filt_basic.c')
-rw-r--r-- | fitz/filt_basic.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fitz/filt_basic.c b/fitz/filt_basic.c index 7e5f2f21..1096f266 100644 --- a/fitz/filt_basic.c +++ b/fitz/filt_basic.c @@ -43,7 +43,7 @@ fz_open_null(fz_stream *chain, int len) fz_context *ctx = chain->ctx; assert(chain); - state = fz_malloc(ctx, sizeof(struct null_filter)); + state = fz_malloc_struct(ctx, struct null_filter); state->chain = chain; state->remain = len; @@ -156,7 +156,7 @@ fz_open_ahxd(fz_stream *chain) { fz_ahxd *state; - state = fz_malloc(chain->ctx, sizeof(fz_ahxd)); + state = fz_malloc_struct(chain->ctx, fz_ahxd); state->chain = chain; state->eod = 0; @@ -294,7 +294,7 @@ fz_open_a85d(fz_stream *chain) fz_a85d *state; assert(chain); - state = fz_malloc(chain->ctx, sizeof(fz_a85d)); + state = fz_malloc_struct(chain->ctx, fz_a85d); state->chain = chain; state->rp = state->bp; state->wp = state->bp; @@ -382,7 +382,7 @@ fz_open_rld(fz_stream *chain) fz_rld *state; assert(chain); - state = fz_malloc(chain->ctx, sizeof(fz_rld)); + state = fz_malloc_struct(chain->ctx, fz_rld); state->chain = chain; state->run = 0; state->n = 0; @@ -425,7 +425,7 @@ fz_open_arc4(fz_stream *chain, unsigned char *key, unsigned keylen) { fz_arc4c *state; - state = fz_malloc(chain->ctx, sizeof(fz_arc4c)); + state = fz_malloc_struct(chain->ctx, fz_arc4c); state->chain = chain; fz_arc4_init(&state->arc4, key, keylen); @@ -508,7 +508,7 @@ fz_open_aesd(fz_stream *chain, unsigned char *key, unsigned keylen) fz_aesd *state; assert(chain); - state = fz_malloc(chain->ctx, sizeof(fz_aesd)); + state = fz_malloc_struct(chain->ctx, fz_aesd); state->chain = chain; aes_setkey_dec(&state->aes, key, keylen * 8); state->ivcount = 0; |