summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-01-07 13:21:53 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-01-08 13:00:45 +0100
commit68e76ae63605193e89b05eab90dc6fdfa6f37053 (patch)
tree7f6205599463cfa44470baf84be62b00dc4c5655 /include
parent83d3ae68a281981bb1193adda61ee42f89810dbd (diff)
downloadmupdf-68e76ae63605193e89b05eab90dc6fdfa6f37053.tar.xz
Add pool allocator.
Diffstat (limited to 'include')
-rw-r--r--include/mupdf/fitz.h3
-rw-r--r--include/mupdf/fitz/pool.h26
2 files changed, 28 insertions, 1 deletions
diff --git a/include/mupdf/fitz.h b/include/mupdf/fitz.h
index 11accf6d..cf78060c 100644
--- a/include/mupdf/fitz.h
+++ b/include/mupdf/fitz.h
@@ -9,9 +9,10 @@
#include "mupdf/fitz/getopt.h"
#include "mupdf/fitz/hash.h"
#include "mupdf/fitz/math.h"
+#include "mupdf/fitz/pool.h"
#include "mupdf/fitz/string.h"
-#include "mupdf/fitz/ucdn.h"
#include "mupdf/fitz/tree.h"
+#include "mupdf/fitz/ucdn.h"
#include "mupdf/fitz/xml.h"
/* I/O */
diff --git a/include/mupdf/fitz/pool.h b/include/mupdf/fitz/pool.h
new file mode 100644
index 00000000..924fb804
--- /dev/null
+++ b/include/mupdf/fitz/pool.h
@@ -0,0 +1,26 @@
+#ifndef MUPDF_FITZ_POOL_H
+#define MUPDF_FITZ_POOL_H
+
+#include "mupdf/fitz/system.h"
+#include "mupdf/fitz/context.h"
+
+typedef struct fz_pool_s fz_pool;
+typedef struct fz_pool_node_s fz_pool_node;
+
+struct fz_pool_s
+{
+ fz_pool_node *head, *tail;
+ char *pos, *end;
+};
+
+struct fz_pool_node_s
+{
+ fz_pool_node *next;
+ char mem[64 << 10]; /* 64k blocks */
+};
+
+fz_pool *fz_new_pool(fz_context *ctx);
+void *fz_pool_alloc(fz_context *ctx, fz_pool *pool, size_t size);
+void fz_drop_pool(fz_context *ctx, fz_pool *pool);
+
+#endif