Types: Add Lth_VectorAlloc and move Lth_pfor
parent
07bf122fdc
commit
4b20d830c4
|
@ -16,8 +16,6 @@
|
||||||
#define Lth_isidenti(c) \
|
#define Lth_isidenti(c) \
|
||||||
(isalnum(c) || c == '_' || c == '$' || c == '\'' || c > 0x80)
|
(isalnum(c) || c == '_' || c == '$' || c == '\'' || c > 0x80)
|
||||||
|
|
||||||
// Post-for. Sort of.
|
|
||||||
#define Lth_pfor(cond, expr) while((cond) && ((expr), true))
|
|
||||||
|
|
||||||
|
|
||||||
// Extern Functions ----------------------------------------------------------|
|
// Extern Functions ----------------------------------------------------------|
|
||||||
|
|
|
@ -22,12 +22,16 @@
|
||||||
#define Lth_Vector(type) struct { type *data; size_t size, bufsz; }
|
#define Lth_Vector(type) struct { type *data; size_t size, bufsz; }
|
||||||
#define Lth_VectorForEach(type, vec) \
|
#define Lth_VectorForEach(type, vec) \
|
||||||
for(type itr = (vec).data; itr != (vec).data + (vec).size; itr++)
|
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_Pair(typef, types) struct { typef first; types second; }
|
||||||
|
|
||||||
#define Lth_WithMbState() \
|
#define Lth_WithMbState() \
|
||||||
__with(mbstate_t state; memset(&state, 0, sizeof(state));)
|
__with(mbstate_t state; memset(&state, 0, sizeof(state));)
|
||||||
|
|
||||||
|
#define Lth_pfor(cond, expr) while((cond) && ((expr), true))
|
||||||
|
|
||||||
|
|
||||||
// Type Definitions ----------------------------------------------------------|
|
// Type Definitions ----------------------------------------------------------|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue