chromium/third_party/pdfium/core/fxcrt/fx_memory.cpp

// Copyright 2014 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#include "core/fxcrt/fx_memory.h"

#include <stdint.h>  // For uintptr_t.
#include <stdlib.h>  // For abort().

#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()
// TODO(thestig): When C++20 is required, replace with std::has_single_bit().
// Returns true iff |value| is a power of 2.
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  // DCHECK_IS_ON()

}  // namespace

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) {}

}  // namespace pdfium::internal