git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Darren Tucker <dtucker@dtucker.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 4/7] Use strtoumax instead of strtoull.
Date: Mon, 18 May 2020 11:29:06 -0700	[thread overview]
Message-ID: <xmqqy2pp2j2l.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200518100356.29292-4-dtucker@dtucker.net> (Darren Tucker's message of "Mon, 18 May 2020 20:03:53 +1000")

Darren Tucker <dtucker@dtucker.net> writes:

> strtoumax is in the compat library so this works on platforms that don't
> have a native strtoull.

The above description (even though is a good one) alone would leave
the reader wondering if this patch now has removed the last use of
strtoull(), removing the need to have NO_STRTOULL in the Makefile
and configure.ac, and also wonder why the patch does not touch
Makefile etc.  Something like

	We still use strtoull() as a part of the compatibility
	implementation of strtoumax(), so we cannot remove the
	support to detect/configure the use of the function in the
	Makefile and autoconf, though.

may deserve to be made into the second paragraph that follows the
above description.

Shouldn't the type of some variables in the codepath also be changed
to make sure we receive the return value from the function in a
variable that is large enough?

Thanks.

> Signed-off-by: Darren Tucker <dtucker@dtucker.net>
> ---
>  t/helper/test-progress.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/t/helper/test-progress.c b/t/helper/test-progress.c
> index 5d05cbe789..3e9eb2abe3 100644
> --- a/t/helper/test-progress.c
> +++ b/t/helper/test-progress.c
> @@ -47,7 +47,7 @@ int cmd__progress(int argc, const char **argv)
>  		char *end;
>  
>  		if (skip_prefix(line.buf, "progress ", (const char **) &end)) {
> -			uint64_t item_count = strtoull(end, &end, 10);
> +			uint64_t item_count = strtoumax(end, &end, 10);
>  			if (*end != '\0')
>  				die("invalid input: '%s'\n", line.buf);
>  			display_progress(progress, item_count);
> @@ -55,10 +55,10 @@ int cmd__progress(int argc, const char **argv)
>  				       (const char **) &end)) {
>  			uint64_t byte_count, test_ms;
>  
> -			byte_count = strtoull(end, &end, 10);
> +			byte_count = strtoumax(end, &end, 10);
>  			if (*end != ' ')
>  				die("invalid input: '%s'\n", line.buf);
> -			test_ms = strtoull(end + 1, &end, 10);
> +			test_ms = strtoumax(end + 1, &end, 10);
>  			if (*end != '\0')
>  				die("invalid input: '%s'\n", line.buf);
>  			progress_test_ns = test_ms * 1000 * 1000;

  reply	other threads:[~2020-05-18 18:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 10:03 [PATCH 1/7] Redirect grep's stderr top null too Darren Tucker
2020-05-18 10:03 ` [PATCH 2/7] Define NO_PREAD for HPUX 11.11 and 11.00 Darren Tucker
2020-05-18 10:03 ` [PATCH 3/7] Test for strtoull in configure Darren Tucker
2020-05-18 10:03 ` [PATCH 4/7] Use strtoumax instead of strtoull Darren Tucker
2020-05-18 18:29   ` Junio C Hamano [this message]
2020-05-18 10:03 ` [PATCH 5/7] Define LLONG_MAX/MIN etc if not already defined Darren Tucker
2020-05-18 10:24   ` Andreas Schwab
2020-05-18 14:41     ` Darren Tucker
2020-05-18 10:03 ` [PATCH 6/7] Check if strtoumax is a macro (eg HP-UX 11.11) Darren Tucker
2020-05-18 17:17   ` Junio C Hamano
2020-05-20  1:49     ` Darren Tucker
2020-05-20  3:19       ` Junio C Hamano
2020-05-18 10:03 ` [PATCH 7/7] Define SCNuMAX if not already defined Darren Tucker
2020-05-18 14:13 ` [PATCH 1/7] Redirect grep's stderr top null too Đoàn Trần Công Danh
2020-05-18 14:29   ` Darren Tucker
2020-05-18 15:30     ` Đoàn Trần Công Danh
2020-05-18 23:22       ` Darren Tucker
2020-05-19  0:56         ` [PATCH] t5703: replace "grep -a" usage by perl Đoàn Trần Công Danh
2020-05-19  2:22           ` Darren Tucker
2020-05-19  7:13           ` Christian Couder
2020-05-19 11:39             ` Đoàn Trần Công Danh
2020-05-19 14:13               ` Christian Couder
2020-05-19 16:09       ` [PATCH 1/7] Redirect grep's stderr top null too Eric Sunshine
2020-05-18 18:20 ` Junio C Hamano

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=xmqqy2pp2j2l.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=dtucker@dtucker.net \
    --cc=git@vger.kernel.org \
    /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).