diff --git a/lithos_c/inc/Lth_stdlib.h b/lithos_c/inc/Lth_stdlib.h index c70f8e1..8681b35 100644 --- a/lithos_c/inc/Lth_stdlib.h +++ b/lithos_c/inc/Lth_stdlib.h @@ -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 ----------------------------------------------------------| diff --git a/lithos_c/inc/Lth_types.h b/lithos_c/inc/Lth_types.h index 4d192df..2849cde 100644 --- a/lithos_c/inc/Lth_types.h +++ b/lithos_c/inc/Lth_types.h @@ -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 ----------------------------------------------------------|