git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Eugenio Gigante <giganteeugenio2@gmail.com>
Cc: christian.couder@gmail.com,  git@vger.kernel.org,
	 sunshine@sunshineco.com
Subject: Re: [PATCH v2 1/1] add: use unsigned type for collection of bits
Date: Thu, 29 Feb 2024 11:52:12 -0800	[thread overview]
Message-ID: <xmqqttlrdp5f.fsf@gitster.g> (raw)
In-Reply-To: <20240229194444.8499-2-giganteeugenio2@gmail.com> (Eugenio Gigante's message of "Thu, 29 Feb 2024 20:44:44 +0100")

Eugenio Gigante <giganteeugenio2@gmail.com> writes:

> The 'refresh' function  in 'builtin/add.c'
> declares 'flags' as signed, and passes it
> as an argument to the 'refresh_index' function,
> which though expects an unsigned value.

OK.  This has become much easier to read by dropping the mention of
the header file where the callee happens to be declared.

Just FYI, in my private rewrite (that I'll discard), I made it like
so:

   builtin/add.c:refresh() declares 'flags' as signed, and uses it
   to call refresh_index() that expects an unsigned value.

> Since in this case 'flags' represents
> a bag of bits, whose MSB is not used
> in special ways, change the type
> of 'flags' to unsigned.

Good, too.

Will queue.

> Signed-off-by: Eugenio Gigante <giganteeugenio2@gmail.com>
> ---
>  builtin/add.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/add.c b/builtin/add.c
> index ada7719561..393c10cbcf 100644
> --- a/builtin/add.c
> +++ b/builtin/add.c
> @@ -115,7 +115,7 @@ static int refresh(int verbose, const struct pathspec *pathspec)
>  	int i, ret = 0;
>  	char *skip_worktree_seen = NULL;
>  	struct string_list only_match_skip_worktree = STRING_LIST_INIT_NODUP;
> -	int flags = REFRESH_IGNORE_SKIP_WORKTREE |
> +	unsigned int flags = REFRESH_IGNORE_SKIP_WORKTREE |
>  		    (verbose ? REFRESH_IN_PORCELAIN : REFRESH_QUIET);
>  
>  	seen = xcalloc(pathspec->nr, 1);

      reply	other threads:[~2024-02-29 19:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-24 11:26 [GSoC][PATCH 0/1] Use unsigned integral type for collection of bits Eugenio Gigante
2024-02-24 11:26 ` [GSoC][PATCH 1/1] add: use unsigned " Eugenio Gigante
2024-02-26  9:59   ` Christian Couder
2024-02-26 22:58     ` Junio C Hamano
2024-02-29 19:44       ` [GSoC][PATCH v2 0/1] Use unsigned integral " Eugenio Gigante
2024-02-29 19:44         ` [PATCH v2 1/1] add: use unsigned " Eugenio Gigante
2024-02-29 19:52           ` Junio C Hamano [this message]

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

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

  git send-email \
    --in-reply-to=xmqqttlrdp5f.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=christian.couder@gmail.com \
    --cc=giganteeugenio2@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sunshine@sunshineco.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.
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 NNTP newsgroup(s).