git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/3] parse-options.h: rename _OPT_CONTAINS_OR_WITH()'s parameters
Date: Mon, 20 Mar 2023 11:16:27 -0700	[thread overview]
Message-ID: <xmqqr0tjl24k.fsf@gitster.g> (raw)
In-Reply-To: <20230319165648.656738-3-szeder.dev@gmail.com> ("SZEDER Gábor"'s message of "Sun, 19 Mar 2023 17:56:47 +0100")

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)

  reply	other threads:[~2023-03-20 18:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-19 16:56 [PATCH 0/3] parse-options.h: use designated initializers in OPT_* macros SZEDER Gábor
2023-03-19 16:56 ` [PATCH 1/3] parse-options.h: use consistent name for the callback parameters SZEDER Gábor
2023-03-19 16:56 ` [PATCH 2/3] parse-options.h: rename _OPT_CONTAINS_OR_WITH()'s parameters SZEDER Gábor
2023-03-20 18:16   ` Junio C Hamano [this message]
2023-03-19 16:56 ` [PATCH 3/3] parse-options.h: use designated initializers in OPT_* macros SZEDER Gábor
2023-03-20 16:53 ` [PATCH 0/3] " Elijah Newren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqr0tjl24k.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).