array: fix a crash in array_create if memory allocation failed and had to
[ajla.git] / layout.h
blob7f78ff45c827d6bb706177dbb8d33435cbda2d77
1 /*
2 * Copyright (C) 2024 Mikulas Patocka
4 * This file is part of Ajla.
6 * Ajla is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, either version 3 of the License, or (at your option) any later
9 * version.
11 * Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * Ajla. If not, see <https://www.gnu.org/licenses/>.
19 #ifndef AJLA_LAYOUT_H
20 #define AJLA_LAYOUT_H
22 struct layout;
24 struct layout *layout_start(uchar_efficient_t slot_bits_, char_efficient_t flags_per_slot_bits, frame_t alignment, frame_t alignment_offset, ajla_error_t *mayfail);
25 bool layout_add(struct layout *l, frame_t size, frame_t align, ajla_error_t *mayfail);
26 bool layout_compute(struct layout *l, bool linear, ajla_error_t *mayfail);
27 frame_t layout_get(struct layout *l, frame_t idx);
28 frame_t layout_size(const struct layout *l);
29 frame_t layout_alignment(const struct layout *l);
30 void layout_free(struct layout *l);
32 #endif