Merge commit 'ee861bc6cf7ccec4a056443488e7b0860b8b0606' as 'external/unarr'

This commit is contained in:
SimoneN64
2024-09-14 16:23:23 +02:00
99 changed files with 20941 additions and 0 deletions

29
external/unarr/common/allocator.h vendored Normal file
View File

@@ -0,0 +1,29 @@
/* Copyright 2015 the unarr project authors (see AUTHORS file).
License: LGPLv3 */
#ifndef common_allocator_h
#define common_allocator_h
#ifdef USE_CUSTOM_ALLOCATOR
#include <stddef.h>
typedef void *(* custom_malloc_fn)(void *opaque, size_t size);
typedef void (* custom_free_fn)(void *opaque, void *ptr);
void ar_set_custom_allocator(custom_malloc_fn custom_malloc, custom_free_fn custom_free, void *opaque);
#define malloc(size) ar_malloc(size)
#define calloc(count, size) ar_calloc(count, size)
#define free(ptr) ar_free(ptr)
#define realloc(ptr, size) _use_malloc_memcpy_free_instead(ptr, size)
#define strdup(str) _use_malloc_memcpy_instead(str)
#elif !defined(NDEBUG) && defined(_MSC_VER)
#include <crtdbg.h>
#endif
#endif