summaryrefslogtreecommitdiffstats
path: root/args.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-12-04 06:31:19 -0800
committerKaz Kylheku <kaz@kylheku.com>2017-12-04 06:31:19 -0800
commit4a8722ce9fcbb66abe2bd304e5a4bad03d842821 (patch)
tree85771680aa329b5436a3916d89bbdc34a9328c8b /args.h
parent507c6c1516233cb565142a71176bc0d3a246d5b4 (diff)
downloadtxr-4a8722ce9fcbb66abe2bd304e5a4bad03d842821.tar.gz
txr-4a8722ce9fcbb66abe2bd304e5a4bad03d842821.tar.bz2
txr-4a8722ce9fcbb66abe2bd304e5a4bad03d842821.zip
args: redesign args extractor to just use array.
* args.c (struct args_bool_key): Structure moved to header file. (struct args_bool_ctx): One more piece of context information, the array size. (args_check_key_store): Work with array of args_bool_key structs rather than linked list. Remove useless local variable "store". (args_key_extract_vl): Function removed. (args_key_extract): Takes array instead of va_list. * args.h (struct args_bool_key): Structure declared here. Loses the next pointer since not used for a linked list. (args_key_extract_vl): Function removed. (args_key_extract): Redeclared. * hash.c (hashv): Adapt to new args_key_extract function.
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 6e0036c0..b3bb91db 100644
--- a/args.h
+++ b/args.h
@@ -41,6 +41,12 @@ typedef int arg_index;
(coerce(struct args *, \
alloca(offsetof(struct args, arg) + (N)*sizeof (val))))
+struct args_bool_key {
+ val key;
+ val arg_p;
+ val *store;
+};
+
INLINE struct args *args_init_list(struct args *args, cnum argc, val list)
{
args->argc = argc;
@@ -189,5 +195,4 @@ val args_copy_to_list(struct args *args);
void args_for_each(struct args *args,
int (*fn)(val arg, int ix, mem_t *ctx),
mem_t *ctx);
-void args_keys_extract_vl(struct args *args, va_list);
-void args_keys_extract(struct args *args, ...);
+void args_keys_extract(struct args *args, struct args_bool_key *, int n);