summaryrefslogtreecommitdiff
path: root/fitz/fitz.h
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2011-10-04 19:51:51 +0100
committerRobin Watts <Robin.Watts@artifex.com>2011-10-04 19:51:51 +0100
commit1cc3bf432a6d94e6f8411b55ee0f591d098f2062 (patch)
treeed1d2b0a91f9357b7a7beb1ee730ad62e944c9cd /fitz/fitz.h
parentd208be26537db558edb70236ae517cea31b7ebab (diff)
downloadmupdf-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.h16
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);