Re: [PATCH 4/7] Use strtoumax instead of strtoull.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Darren Tucker <dtucker@xxxxxxxxxxx> 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@xxxxxxxxxxx>
> ---
>  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;



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux