List symbols from symtab
This commit is contained in:
27
da.h
Normal file
27
da.h
Normal 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_
|
||||
Reference in New Issue
Block a user