[flang][OpenMP] Use range-for to iterate over SymbolSourceMap, NFC
[llvm-project.git] / libc / src / stdlib / freelist_malloc.cpp
blobfe56fad769378a23e44511ae553ec63ad07de226
1 //===-- Implementation for freelist_malloc --------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "src/__support/freelist_heap.h"
10 #include "src/__support/macros/config.h"
11 #include "src/stdlib/aligned_alloc.h"
12 #include "src/stdlib/calloc.h"
13 #include "src/stdlib/free.h"
14 #include "src/stdlib/malloc.h"
15 #include "src/stdlib/realloc.h"
17 #include <stddef.h>
19 namespace LIBC_NAMESPACE_DECL {
21 static LIBC_CONSTINIT FreeListHeap freelist_heap_symbols;
22 FreeListHeap *freelist_heap = &freelist_heap_symbols;
24 LLVM_LIBC_FUNCTION(void *, malloc, (size_t size)) {
25 return freelist_heap->allocate(size);
28 LLVM_LIBC_FUNCTION(void, free, (void *ptr)) { return freelist_heap->free(ptr); }
30 LLVM_LIBC_FUNCTION(void *, calloc, (size_t num, size_t size)) {
31 return freelist_heap->calloc(num, size);
34 LLVM_LIBC_FUNCTION(void *, realloc, (void *ptr, size_t size)) {
35 return freelist_heap->realloc(ptr, size);
38 LLVM_LIBC_FUNCTION(void *, aligned_alloc, (size_t alignment, size_t size)) {
39 return freelist_heap->aligned_allocate(alignment, size);
42 } // namespace LIBC_NAMESPACE_DECL