summaryrefslogtreecommitdiffstats
path: root/args.h
diff options
context:
space:
mode:
Diffstat (limited to 'args.h')
-rw-r--r--args.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/args.h b/args.h
index 6f4baa43..df8cb3db 100644
--- a/args.h
+++ b/args.h
@@ -64,14 +64,19 @@ INLINE void args_set_fill(struct args *args, cnum fill)
}
#define args_decl_list(NAME, N, L) \
+ struct { struct args args; val arg[N]; } _ac; \
+ struct args *NAME = args_init_list(&_ac.args, N, L)
+
+#define args_decl_constsize(NAME, N) args_decl_list(NAME, N, nil)
+
+#define args_decl_list_dyn(NAME, N, L) \
mem_t *NAME ## _mem = \
coerce(mem_t *, \
alloca(offsetof(struct args, arg) + (N)*sizeof (val))); \
struct args *NAME = args_init_list(coerce(struct args *, \
NAME ## _mem), N, L)
-#define args_decl(NAME, N) args_decl_list(NAME, N, nil)
-
+#define args_decl(NAME, N) args_decl_list_dyn(NAME, N, nil)
INLINE val args_add(struct args *args, val arg)
{