Make VEC_GET take an index along with the type

Since most use cases require indexing the data directly, and the macro
implies you're retrieving data from it, may as well take the index.

If you wanted a pointer to that data, &VEC_GET(vec, index, type) works
just fine.
This commit is contained in:
2026-01-21 09:48:29 +00:00
parent 8c190e955d
commit 865ab22fdc
3 changed files with 9 additions and 9 deletions

View File

@@ -40,7 +40,7 @@ void sys_cleanup(sys_t *sys)
// Iterate through each cons currently allocated and free them
for (size_t i = 0; i < VEC_SIZE(&sys->conses, lisp_t **); ++i)
{
lisp_t *allocated = VEC_GET(&sys->conses, lisp_t *)[i];
lisp_t *allocated = VEC_GET(&sys->conses, i, lisp_t *);
switch (get_tag(allocated))
{
case TAG_CONS: