From 7519eafc6787cc71dcdc252584fdfd081f4698ad Mon Sep 17 00:00:00 2001 From: Ákos Kőrösi Date: Tue, 12 May 2026 14:17:20 +0200 Subject: turn proc sub into a token with a region associated --- typeutils.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'typeutils.h') 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; \ } -- cgit v1.2.3