From b4b72a51d5b7c6d384b60f9140207ea4dc222b49 Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Fri, 30 Sep 2022 16:34:08 +0200 Subject: [PATCH] replace READOPT_ALLOC_STRINGS with READOPT_STRINGS The word "alloc" could be misleading in this context. --- readopt.h | 2 +- test/test.c | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/readopt.h b/readopt.h index ad6c6ab..f14e1bd 100644 --- a/readopt.h +++ b/readopt.h @@ -4,7 +4,7 @@ #include -#define READOPT_ALLOC_STRINGS(...) ((char *[]){__VA_ARGS__, NULL}) +#define READOPT_STRINGS(...) ((char *[]){__VA_ARGS__, NULL}) enum readopt_error { diff --git a/test/test.c b/test/test.c index 15fbc58..03f18aa 100644 --- a/test/test.c +++ b/test/test.c @@ -7,8 +7,8 @@ int main(int argc, char **argv) struct readopt_opt opts[] = { { .names = { - [READOPT_FORM_SHORT] = READOPT_ALLOC_STRINGS("e", "x"), - [READOPT_FORM_LONG] = READOPT_ALLOC_STRINGS("expr", "expression"), + [READOPT_FORM_SHORT] = READOPT_STRINGS("e", "x"), + [READOPT_FORM_LONG] = READOPT_STRINGS("expr", "expression"), }, .cont = { .req = 1, @@ -20,8 +20,8 @@ int main(int argc, char **argv) }, { .names = { - [READOPT_FORM_SHORT] = READOPT_ALLOC_STRINGS("c"), - [READOPT_FORM_LONG] = READOPT_ALLOC_STRINGS("config"), + [READOPT_FORM_SHORT] = READOPT_STRINGS("c"), + [READOPT_FORM_LONG] = READOPT_STRINGS("config"), }, .cont = { .req = 1, @@ -35,8 +35,8 @@ int main(int argc, char **argv) }, { .names = { - [READOPT_FORM_SHORT] = READOPT_ALLOC_STRINGS("i"), - [READOPT_FORM_LONG] = READOPT_ALLOC_STRINGS("uri"), + [READOPT_FORM_SHORT] = READOPT_STRINGS("i"), + [READOPT_FORM_LONG] = READOPT_STRINGS("uri"), }, .cont = { .req = 1, @@ -45,8 +45,8 @@ int main(int argc, char **argv) }, { .names = { - [READOPT_FORM_SHORT] = READOPT_ALLOC_STRINGS("b"), - [READOPT_FORM_LONG] = READOPT_ALLOC_STRINGS("backup", "backup-file"), + [READOPT_FORM_SHORT] = READOPT_STRINGS("b"), + [READOPT_FORM_LONG] = READOPT_STRINGS("backup", "backup-file"), }, .cont = { .req = 1, @@ -55,8 +55,8 @@ int main(int argc, char **argv) }, { .names = { - [READOPT_FORM_SHORT] = READOPT_ALLOC_STRINGS("v"), - [READOPT_FORM_LONG] = READOPT_ALLOC_STRINGS("verbose"), + [READOPT_FORM_SHORT] = READOPT_STRINGS("v"), + [READOPT_FORM_LONG] = READOPT_STRINGS("verbose"), }, .cont.oper.bounds.val = { 3, @@ -64,14 +64,14 @@ int main(int argc, char **argv) }, { .names = { - [READOPT_FORM_SHORT] = READOPT_ALLOC_STRINGS("s"), - [READOPT_FORM_LONG] = READOPT_ALLOC_STRINGS("sort"), + [READOPT_FORM_SHORT] = READOPT_STRINGS("s"), + [READOPT_FORM_LONG] = READOPT_STRINGS("sort"), }, .cont.oper.bounds.inf = 1, }, { .names = { - [READOPT_FORM_LONG] = READOPT_ALLOC_STRINGS("help"), + [READOPT_FORM_LONG] = READOPT_STRINGS("help"), }, .cont.oper.bounds.val = { 1, @@ -79,8 +79,8 @@ int main(int argc, char **argv) }, { .names = { - [READOPT_FORM_SHORT] = READOPT_ALLOC_STRINGS("V"), - [READOPT_FORM_LONG] = READOPT_ALLOC_STRINGS("version"), + [READOPT_FORM_SHORT] = READOPT_STRINGS("V"), + [READOPT_FORM_LONG] = READOPT_STRINGS("version"), }, .cont.oper.bounds.val = { 1,