diff options
| 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 |
| commit | 7519eafc6787cc71dcdc252584fdfd081f4698ad (patch) | |
| tree | 99b1d9d548522a1434f5272df1715565b8406396 /typeutils.h | |
| parent | 3297384ec22c4931dc86b2429c8afe25b436682d (diff) | |
turn proc sub into a token with a region associated
Diffstat (limited to 'typeutils.h')
| -rw-r--r-- | typeutils.h | 7 |
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; \ } |
