#include "core/fxcrt/fx_memory.h"
#include <stdint.h>
#include <stdlib.h>
#include <iterator>
#include <limits>
#include <type_traits>
#include "build/build_config.h"
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/debug/alias.h"
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#endif
#if BUILDFLAG(IS_ANDROID)
#include <malloc.h>
#endif
namespace {
#if DCHECK_IS_ON()
template <typename T, typename = std::enable_if<std::is_integral<T>::value>>
constexpr inline bool IsPowerOfTwo(T value) { … }
#ifdef __has_builtin
#define SUPPORTS_BUILTIN_IS_ALIGNED …
#else
#define SUPPORTS_BUILTIN_IS_ALIGNED …
#endif
inline bool IsAligned(void* val, size_t alignment) { … }
#undef SUPPORTS_BUILTIN_IS_ALIGNED
#endif
}
void* FXMEM_DefaultAlloc(size_t byte_size) { … }
void* FXMEM_DefaultCalloc(size_t num_elems, size_t byte_size) { … }
void* FXMEM_DefaultRealloc(void* pointer, size_t new_size) { … }
void FXMEM_DefaultFree(void* pointer) { … }
NOINLINE void FX_OutOfMemoryTerminate(size_t size) { … }
void* FX_AlignedAlloc(size_t size, size_t alignment) { … }
namespace pdfium::internal {
void* Alloc2D(size_t w, size_t h, size_t member_size) { … }
void* AllocOrDie(size_t num_members, size_t member_size) { … }
void* AllocOrDie2D(size_t w, size_t h, size_t member_size) { … }
void* CallocOrDie(size_t num_members, size_t member_size) { … }
void* CallocOrDie2D(size_t w, size_t h, size_t member_size) { … }
void* ReallocOrDie(void* ptr, size_t num_members, size_t member_size) { … }
void* StringAllocOrDie(size_t num_members, size_t member_size) { … }
}