diff options
Diffstat (limited to 'dviware/dvisvgm/libs/brotli/enc/memory.h')
-rw-r--r-- | dviware/dvisvgm/libs/brotli/enc/memory.h | 21 |
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 |