summaryrefslogtreecommitdiff
path: root/typeutils.h
diff options
context:
space:
mode:
authorÁkos Kőrösi <korakos99@gmail.com>2026-05-12 14:17:20 +0200
committerÁkos Kőrösi <korakos99@gmail.com>2026-05-12 14:17:20 +0200
commit7519eafc6787cc71dcdc252584fdfd081f4698ad (patch)
tree99b1d9d548522a1434f5272df1715565b8406396 /typeutils.h
parent3297384ec22c4931dc86b2429c8afe25b436682d (diff)
turn proc sub into a token with a region associated
Diffstat (limited to 'typeutils.h')
-rw-r--r--typeutils.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/typeutils.h b/typeutils.h
index fd285b2..d83217d 100644
--- a/typeutils.h
+++ b/typeutils.h
@@ -23,7 +23,7 @@
.incr_step = step, \
}; \
} \
- static inline void push_to_##Name(Name* vec, T item) { \
+ static inline T* push_to_##Name(Name* vec, T item) { \
if (vec->count == vec->cap) { \
vec->cap += vec->incr_step; \
vec->items = realloc( \
@@ -31,7 +31,10 @@
vec->cap * sizeof(T) \
); \
} \
- vec->items[vec->count++] = item; \
+ vec->items[vec->count] = item; \
+ T* ptr = &vec->items[vec->count]; \
+ vec->count++; \
+ return ptr; \
}