public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
168a39fd9d34234a84e3dfd8d491c220cc735102 blob 1120 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
/*
 * Copyright (C) 2024 olang maintainers
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
#ifndef ARENA_H
#define ARENA_H
#include <stdint.h>
#include <stdlib.h>

#define ARENA_ALIGNMENT_BYTES 16
#define ARENA_ALIGNMENT_BYTES_MASK (ARENA_ALIGNMENT_BYTES - 1)

typedef struct arena {
    size_t offset;
    size_t size;
    uint8_t *region;
} arena_t;

arena_t
arena_new(size_t size);

void *
arena_alloc(arena_t *arena, size_t size);

void
arena_release(arena_t *arena);

void
arena_free(arena_t *arena);

#endif
debug log:

solving 168a39f ...
found 168a39f in http://lists.johnnyrichard.com/olang/20241010013318.222905-3-carlos@maniero.me/
found 03fd803 in https://git.johnnyrichard.com/olang.git
preparing index
index prepared:
100644 03fd80301af5d2c20831c1fd6e5e8e29db83b8b6	src/arena.h

applying [1/1] http://lists.johnnyrichard.com/olang/20241010013318.222905-3-carlos@maniero.me/
diff --git a/src/arena.h b/src/arena.h
index 03fd803..168a39f 100644

Checking patch src/arena.h...
Applied patch src/arena.h cleanly.

index at:
100644 168a39fd9d34234a84e3dfd8d491c220cc735102	src/arena.h

Code repositories for project(s) associated with this public inbox

	https://git.johnnyrichard.com/olang.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox