first commit
This commit is contained in:
19
include/nva/util.h
Normal file
19
include/nva/util.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef UTIL_H
|
||||
#define UTIL_H
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof (a) / sizeof *(a))
|
||||
#define ADDARRAY(a, e) \
|
||||
do { \
|
||||
if ((a ## num) >= (a ## max)) { \
|
||||
if (!(a ## max)) \
|
||||
(a ## max) = 16; \
|
||||
else \
|
||||
(a ## max) *= 2; \
|
||||
(a) = realloc((a), (a ## max)*sizeof(*(a))); \
|
||||
} \
|
||||
(a)[(a ## num)++] = (e); \
|
||||
} while(0)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user