List symbols from symtab

This commit is contained in:
2025-03-10 12:36:21 +01:00
parent 31f6fa1cc1
commit 6687646a53
3 changed files with 112 additions and 2 deletions

27
da.h Normal file
View File

@@ -0,0 +1,27 @@
#ifndef DA_H_
#define DA_H_
#include <stdlib.h>
#define da_append(da, item) \
do { \
if ((da)->count == 0) { \
(da)->capacity = 1; \
(da)->items = malloc(sizeof(item)*sizeof((da)->capacity)); \
} else { \
if ((da)->count == (da)->capacity) { \
(da)->capacity *= 2; \
(da)->items = realloc((da)->items, (da)->capacity * sizeof((item))); \
} \
} \
(da)->items[(da)->count++] = (item); \
} while(0)
#define da_deinit(da) \
do { \
if ((da)->count > 0) { \
free((da)->items); \
} \
} while(0)
#endif // DA_H_