public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
37a36aa76a598611e054addc8b87a23dc5319dff blob 1134 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
44
 
/*
 * 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 sizeof(intptr_t)
#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 37a36aa ...
found 37a36aa in http://lists.johnnyrichard.com/olang/20240221150911.3670778-1-carlos@maniero.me/
found 157165c in https://git.johnnyrichard.com/olang.git
preparing index
index prepared:
100644 157165cd1766da4807574b5370902f2aa2be1204	src/arena.h

applying [1/1] http://lists.johnnyrichard.com/olang/20240221150911.3670778-1-carlos@maniero.me/
diff --git a/src/arena.h b/src/arena.h
index 157165c..37a36aa 100644

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

index at:
100644 37a36aa76a598611e054addc8b87a23dc5319dff	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