#define C_ARRAY_SIZE_TYPE uint32_t
#endif
-#define DECLARE_C_ARRAY(__type, __name, __page) \
+#define DECLARE_C_ARRAY(__type, __name, __page, __args...) \
enum { __name##_page_size = __page }; \
typedef __type __name##_element_t; \
typedef C_ARRAY_SIZE_TYPE __name##_count_t; \
volatile __name##_count_t count;\
volatile __name##_count_t size;\
__name##_element_t * e;\
+ __args ;\
} __name##_t, *__name##_p;
#define C_ARRAY_NULL { 0, 0, NULL }
char str[0];
} str_t, *str_p;
+static inline str_p str_alloc(size_t len)
+{
+ str_p r = (str_p)malloc(sizeof(*r) + len + 1);
+ r->rom = r->hash = 0; r->len = len;
+ return r;
+}
static inline str_p str_new_i(const char *s, void * (*_alloc)(size_t))
{
int l = s ? strlen(s) : 0;
{
return str_new_i(s, malloc);
}
-static inline str_p str_anew(const char *s)
-{
- str_p r = str_new_i(s, alloca);
- r->rom = 1;
- return r;
-}
static inline str_p str_dup(const str_p s)
{
size_t l = sizeof(*s) + s->len + 1;
return r;
}
#ifndef NO_ALLOCA
+static inline str_p str_anew(const char *s)
+{
+ str_p r = str_new_i(s, alloca);
+ r->rom = 1;
+ return r;
+}
static inline str_p str_adup(const str_p s)
{
size_t l = sizeof(*s) + s->len + 1;