diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2011-10-04 19:51:51 +0100 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2011-10-04 19:51:51 +0100 |
commit | 1cc3bf432a6d94e6f8411b55ee0f591d098f2062 (patch) | |
tree | ed1d2b0a91f9357b7a7beb1ee730ad62e944c9cd /fitz/fitz.h | |
parent | d208be26537db558edb70236ae517cea31b7ebab (diff) | |
download | mupdf-1cc3bf432a6d94e6f8411b55ee0f591d098f2062.tar.xz |
Reintroduce alloc context section.
This was removed during a previous commit to make the editing easier.
Now added back in.
Diffstat (limited to 'fitz/fitz.h')
-rw-r--r-- | fitz/fitz.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/fitz/fitz.h b/fitz/fitz.h index aa9ff222..83eade3b 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -145,9 +145,12 @@ struct fz_alloc_context_s void *user; void *(*malloc)(void *, unsigned int); void *(*realloc)(void *, void *, unsigned int); - void *(*free)(void *, void *, unsigned int); + void (*free)(void *, void *); }; +/* Default allocator */ +extern fz_alloc_context fz_alloc_default; + struct fz_error_context_s { int top; @@ -185,11 +188,12 @@ void fz_flush_warnings(fz_context *ctx); struct fz_context_s { + fz_alloc_context *alloc; fz_error_context *error; fz_warn_context *warn; }; -fz_context *fz_new_context(void); +fz_context *fz_new_context(fz_alloc_context *alloc); fz_context *fz_clone_context(fz_context *ctx); void fz_free_context(fz_context *ctx); @@ -208,6 +212,14 @@ char *fz_strdup(fz_context *ctx, char *s); void fz_free(fz_context *ctx, void *p); +/* The following returns NULL on failure to allocate */ +void *fz_malloc_no_throw(fz_context *ctx, unsigned int size); +void *fz_malloc_array_no_throw(fz_context *ctx, unsigned int count, unsigned int size); +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); + + /* runtime (hah!) test for endian-ness */ int fz_is_big_endian(void); |