summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/libs/brotli/enc/memory.h
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-11-16 03:01:15 +0000
committerNorbert Preining <norbert@preining.info>2023-11-16 03:01:15 +0000
commite0db3f0709a737e7258fd40a7cbfe9a461ea0756 (patch)
treee81cfc35b6602ffceefa73b8971ce3b94312820a /dviware/dvisvgm/libs/brotli/enc/memory.h
parentf5460c92605f1b3b17448b27ce53375157c3e4b1 (diff)
CTAN sync 202311160301
Diffstat (limited to 'dviware/dvisvgm/libs/brotli/enc/memory.h')
-rw-r--r--dviware/dvisvgm/libs/brotli/enc/memory.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/dviware/dvisvgm/libs/brotli/enc/memory.h b/dviware/dvisvgm/libs/brotli/enc/memory.h
index 832e7b2b6e..a4417df4cb 100644
--- a/dviware/dvisvgm/libs/brotli/enc/memory.h
+++ b/dviware/dvisvgm/libs/brotli/enc/memory.h
@@ -11,9 +11,10 @@
#include <string.h> /* memcpy */
-#include "../common/platform.h"
#include <brotli/types.h>
+#include "../common/platform.h"
+
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
@@ -23,6 +24,16 @@ extern "C" {
#define BROTLI_ENCODER_EXIT_ON_OOM
#endif
+#if !defined(BROTLI_ENCODER_EXIT_ON_OOM)
+#if defined(BROTLI_EXPERIMENTAL)
+#define BROTLI_ENCODER_MEMORY_MANAGER_SLOTS (48*1024)
+#else /* BROTLI_EXPERIMENTAL */
+#define BROTLI_ENCODER_MEMORY_MANAGER_SLOTS 256
+#endif /* BROTLI_EXPERIMENTAL */
+#else /* BROTLI_ENCODER_EXIT_ON_OOM */
+#define BROTLI_ENCODER_MEMORY_MANAGER_SLOTS 0
+#endif /* BROTLI_ENCODER_EXIT_ON_OOM */
+
typedef struct MemoryManager {
brotli_alloc_func alloc_func;
brotli_free_func free_func;
@@ -32,7 +43,7 @@ typedef struct MemoryManager {
size_t perm_allocated;
size_t new_allocated;
size_t new_freed;
- void* pointers[256];
+ void* pointers[BROTLI_ENCODER_MEMORY_MANAGER_SLOTS];
#endif /* BROTLI_ENCODER_EXIT_ON_OOM */
} MemoryManager;
@@ -107,6 +118,12 @@ V: value to append
A[(S) - 1] = (V); \
}
+/* "Bootstrap" allocations are not tracked by memory manager; should be used
+ only to allocate MemoryManager itself (or structure containing it). */
+BROTLI_INTERNAL void* BrotliBootstrapAlloc(size_t size,
+ brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque);
+BROTLI_INTERNAL void BrotliBootstrapFree(void* address, MemoryManager* m);
+
#if defined(__cplusplus) || defined(c_plusplus)
} /* extern "C" */
#endif