From e0db3f0709a737e7258fd40a7cbfe9a461ea0756 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 16 Nov 2023 03:01:15 +0000 Subject: CTAN sync 202311160301 --- dviware/dvisvgm/libs/brotli/enc/memory.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'dviware/dvisvgm/libs/brotli/enc/memory.h') 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 /* memcpy */ -#include "../common/platform.h" #include +#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 -- cgit v1.2.3