diff mbox series

[2/3] parse-options.h: rename _OPT_CONTAINS_OR_WITH()'s parameters

Message ID 20230319165648.656738-3-szeder.dev@gmail.com (mailing list archive)
State Accepted
Commit aa0275a2c030c9c03f7934340ce1496d8796954e
Headers show
Series parse-options.h: use designated initializers in OPT_* macros | expand

Commit Message

SZEDER Gábor March 19, 2023, 4:56 p.m. UTC
Rename the 'help' parameter as it matches one of the fields in 'struct
option', and, while at it, rename all other parameters to the usual
one-letter name used in similar macro definitions.

Furthermore, put all parameters in the replacement list between
parentheses, like all other OPT_* macros do.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 parse-options.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Junio C Hamano March 20, 2023, 6:16 p.m. UTC | #1
SZEDER Gábor <szeder.dev@gmail.com> writes:

> Rename the 'help' parameter as it matches one of the fields in 'struct
> option', and, while at it, rename all other parameters to the usual
> one-letter name used in similar macro definitions.
>
> Furthermore, put all parameters in the replacement list between
> parentheses, like all other OPT_* macros do.

This step when taken alone smells like it is going backwards in the
readability department by going from a set meaningful names to
another set of more cryptic names, but together with 3/3 where the
designated initializers clarify what these cryptic args with short
names correspond to, the end result gives us a pleasant read.

Thanks.

>
> Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
> ---
>  parse-options.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/parse-options.h b/parse-options.h
> index 34f8caf369..7e99322bab 100644
> --- a/parse-options.h
> +++ b/parse-options.h
> @@ -381,9 +381,9 @@ int parse_opt_tracking_mode(const struct option *, const char *, int);
>  	{ OPTION_CALLBACK, (s), (l), (v), (a), (h), (f), parse_opt_passthru }
>  #define OPT_PASSTHRU_ARGV(s, l, v, a, h, f) \
>  	{ OPTION_CALLBACK, (s), (l), (v), (a), (h), (f), parse_opt_passthru_argv }
> -#define _OPT_CONTAINS_OR_WITH(name, variable, help, flag) \
> -	{ OPTION_CALLBACK, 0, name, (variable), N_("commit"), (help), \
> -	  PARSE_OPT_LASTARG_DEFAULT | flag, \
> +#define _OPT_CONTAINS_OR_WITH(l, v, h, f) \
> +	{ OPTION_CALLBACK, 0, (l), (v), N_("commit"), (h), \
> +	  PARSE_OPT_LASTARG_DEFAULT | (f), \
>  	  parse_opt_commits, (intptr_t) "HEAD" \
>  	}
>  #define OPT_CONTAINS(v, h) _OPT_CONTAINS_OR_WITH("contains", v, h, PARSE_OPT_NONEG)
diff mbox series

Patch

diff --git a/parse-options.h b/parse-options.h
index 34f8caf369..7e99322bab 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -381,9 +381,9 @@  int parse_opt_tracking_mode(const struct option *, const char *, int);
 	{ OPTION_CALLBACK, (s), (l), (v), (a), (h), (f), parse_opt_passthru }
 #define OPT_PASSTHRU_ARGV(s, l, v, a, h, f) \
 	{ OPTION_CALLBACK, (s), (l), (v), (a), (h), (f), parse_opt_passthru_argv }
-#define _OPT_CONTAINS_OR_WITH(name, variable, help, flag) \
-	{ OPTION_CALLBACK, 0, name, (variable), N_("commit"), (help), \
-	  PARSE_OPT_LASTARG_DEFAULT | flag, \
+#define _OPT_CONTAINS_OR_WITH(l, v, h, f) \
+	{ OPTION_CALLBACK, 0, (l), (v), N_("commit"), (h), \
+	  PARSE_OPT_LASTARG_DEFAULT | (f), \
 	  parse_opt_commits, (intptr_t) "HEAD" \
 	}
 #define OPT_CONTAINS(v, h) _OPT_CONTAINS_OR_WITH("contains", v, h, PARSE_OPT_NONEG)