diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2012-02-03 13:58:07 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2012-02-03 14:00:55 +0100 |
commit | 977ad5326276de29f0b2ae212a1cb4c09d8d94e0 (patch) | |
tree | c3b4a55e14117c9efdddecb631736d3a307579c2 /fitz | |
parent | d5b9e3c95500c159a2dfc40657ab95da5f2777dd (diff) | |
download | mupdf-977ad5326276de29f0b2ae212a1cb4c09d8d94e0.tar.xz |
Make fz_malloc_struct return zeroed memory.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/dev_null.c | 1 | ||||
-rw-r--r-- | fitz/filt_dctd.c | 1 | ||||
-rw-r--r-- | fitz/fitz.h | 6 |
3 files changed, 3 insertions, 5 deletions
diff --git a/fitz/dev_null.c b/fitz/dev_null.c index 183c4e21..b4ba5cbe 100644 --- a/fitz/dev_null.c +++ b/fitz/dev_null.c @@ -4,7 +4,6 @@ fz_device * fz_new_device(fz_context *ctx, void *user) { fz_device *dev = fz_malloc_struct(ctx, fz_device); - memset(dev, 0, sizeof *dev); dev->hints = 0; dev->flags = 0; dev->user = user; diff --git a/fitz/filt_dctd.c b/fitz/filt_dctd.c index 03dfe87c..4357f3d7 100644 --- a/fitz/filt_dctd.c +++ b/fitz/filt_dctd.c @@ -224,7 +224,6 @@ fz_open_dctd(fz_stream *chain, int color_transform) fz_try(ctx) { state = fz_malloc_struct(chain->ctx, fz_dctd); - memset(state, 0, sizeof(fz_dctd)); state->ctx = ctx; state->chain = chain; state->color_transform = color_transform; diff --git a/fitz/fitz.h b/fitz/fitz.h index 3eebaf59..8483817d 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -400,8 +400,8 @@ fz_unlock(fz_context *ctx) /* The following throw exceptions on failure to allocate */ void *fz_malloc(fz_context *ctx, unsigned int size); -void *fz_malloc_array(fz_context *ctx, unsigned int count, unsigned int size); void *fz_calloc(fz_context *ctx, unsigned int count, unsigned int size); +void *fz_malloc_array(fz_context *ctx, unsigned int count, unsigned int size); void *fz_resize_array(fz_context *ctx, void *p, unsigned int count, unsigned int size); char *fz_strdup(fz_context *ctx, char *s); @@ -414,9 +414,9 @@ void *fz_calloc_no_throw(fz_context *ctx, unsigned int count, unsigned int size) void *fz_resize_array_no_throw(fz_context *ctx, void *p, unsigned int count, unsigned int size); char *fz_strdup_no_throw(fz_context *ctx, char *s); +/* alloc and zero a struct, and tag it for memento */ #define fz_malloc_struct(CTX, STRUCT) \ - Memento_label(fz_malloc(CTX,sizeof(STRUCT)), #STRUCT) - + Memento_label(fz_calloc(CTX,1,sizeof(STRUCT)), #STRUCT) /* runtime (hah!) test for endian-ness */ int fz_is_big_endian(void); |