blob: 8d2aa113b68d7e3c57d3e70980425517b601513b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include <stdlib.h>
#include "alloc.h"
#include "errors.h"
#include "macros.h"
void *
alloc_arena(void *raw_ctx, void *ptr, size_t old, size_t new, size_t elemsz,
size_t align)
{
struct arena_ctx *ctx = raw_ctx;
ASSUME(ctx != nullptr);
ASSUME(ctx->a != nullptr);
void *p = arena_realloc(ctx->a, ptr, old, new, elemsz, align);
if (new == 0 || p != nullptr)
return p;
if (ctx->jmp != nullptr)
longjmp(*ctx->jmp, 1);
err("arena_realloc:");
}
|