aboutsummaryrefslogtreecommitdiffstats
path: root/src/badlib.h
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2024-06-16 11:20:28 +0200
committerBad Diode <bd@badd10de.dev>2024-06-16 11:20:28 +0200
commitc2c8796511c90930c41700f5fcd2043a5c4405c9 (patch)
treee121750568a77ad56e599660fd340494849a01fe /src/badlib.h
parente7cd0d47a603e4199b0ee7daa2434fc0db602bad (diff)
downloadbdl-c2c8796511c90930c41700f5fcd2043a5c4405c9.tar.gz
bdl-c2c8796511c90930c41700f5fcd2043a5c4405c9.zip
Setup initial Pratt parser
Diffstat (limited to 'src/badlib.h')
-rw-r--r--src/badlib.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/badlib.h b/src/badlib.h
index a91fcf8..71f4bee 100644
--- a/src/badlib.h
+++ b/src/badlib.h
@@ -11,6 +11,7 @@
11// - Implement binary search for searching into an array: 11// - Implement binary search for searching into an array:
12// SearchResult find_array(Array haystack, Array needle). 12// SearchResult find_array(Array haystack, Array needle).
13// - Logger functions for hash map and queues. 13// - Logger functions for hash map and queues.
14// - Make assert/abort macros dump the file name/line?
14// 15//
15 16
16#include <stdarg.h> 17#include <stdarg.h>
@@ -811,6 +812,9 @@ _array_reserve(sz num_elem, sz type_size, Arena *a) {
811 812
812static inline void * 813static inline void *
813_array_maybe_grow(void *arr, sz type_size, Arena *a) { 814_array_maybe_grow(void *arr, sz type_size, Arena *a) {
815 if (!arr) {
816 arr = _array_reserve(0, 0, a);
817 }
814 ArrayHeader *head = array_head(arr); 818 ArrayHeader *head = array_head(arr);
815 if (head->cap == head->size) { 819 if (head->cap == head->size) {
816 sz prev_size = head->cap * type_size + sizeof(ArrayHeader); 820 sz prev_size = head->cap * type_size + sizeof(ArrayHeader);