Blender V4.3
BLI_memarena.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#pragma once
10
11#include "BLI_compiler_attrs.h"
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
21#define BLI_MEMARENA_STD_BUFSIZE MEM_SIZE_OPTIMAL(1 << 14)
22
23struct MemArena;
24typedef struct MemArena MemArena;
25
26struct MemArena *BLI_memarena_new(size_t bufsize,
29void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1);
32void BLI_memarena_use_align(struct MemArena *ma, size_t align) ATTR_NONNULL(1);
33void *BLI_memarena_alloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT
35void *BLI_memarena_calloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT
37
48void BLI_memarena_merge(MemArena *ma_dst, MemArena *ma_src) ATTR_NONNULL(1, 2);
49
55
56#ifdef __cplusplus
57}
58#endif
#define ATTR_WARN_UNUSED_RESULT
#define ATTR_MALLOC
#define ATTR_ALLOC_SIZE(...)
#define ATTR_RETURNS_NONNULL
#define ATTR_NONNULL(...)
void * BLI_memarena_alloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void * BLI_memarena_calloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1)
void BLI_memarena_use_malloc(struct MemArena *ma) ATTR_NONNULL(1)
struct MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
void BLI_memarena_merge(MemArena *ma_dst, MemArena *ma_src) ATTR_NONNULL(1
void BLI_memarena_use_calloc(struct MemArena *ma) ATTR_NONNULL(1)
void BLI_memarena_use_align(struct MemArena *ma, size_t align) ATTR_NONNULL(1)
void void BLI_memarena_clear(MemArena *ma) ATTR_NONNULL(1)
size_t align
size_t bufsize