1
0
Fork 0

Types: Add Lth_VectorAlloc and move Lth_pfor

master
Marrub 2016-11-21 01:02:56 -05:00
parent 07bf122fdc
commit 4b20d830c4
2 changed files with 4 additions and 2 deletions

View File

@ -16,8 +16,6 @@
#define Lth_isidenti(c) \
(isalnum(c) || c == '_' || c == '$' || c == '\'' || c > 0x80)
// Post-for. Sort of.
#define Lth_pfor(cond, expr) while((cond) && ((expr), true))
// Extern Functions ----------------------------------------------------------|

View File

@ -22,12 +22,16 @@
#define Lth_Vector(type) struct { type *data; size_t size, bufsz; }
#define Lth_VectorForEach(type, vec) \
for(type itr = (vec).data; itr != (vec).data + (vec).size; itr++)
#define Lth_VectorAlloc(type, vec) \
(vec).data = calloc((vec).size, sizeof(type))
#define Lth_Pair(typef, types) struct { typef first; types second; }
#define Lth_WithMbState() \
__with(mbstate_t state; memset(&state, 0, sizeof(state));)
#define Lth_pfor(cond, expr) while((cond) && ((expr), true))
// Type Definitions ----------------------------------------------------------|