Re: [PATCH] http.postbuffer: make a size_t
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 30, 2017, 22:07 UTC
- Message-ID
- <xmqqwpb61kre.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170330202917.24281-1-dturner@twosigma.com>
David Turner <dturner@twosigma.com> writes:
Show 35 quoted lines
> Unfortunately, in order to push some large repos, the http postbuffer
> must sometimes exceed two gigabytes. On a 64-bit system, this is OK:
> we just malloc a larger buffer.
>
> Signed-off-by: David Turner <dturner@twosigma.com>
> ---
> cache.h | 1 +
> config.c | 17 +++++++++++++++++
> http.c | 2 +-
> 3 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/cache.h b/cache.h
> index fbdf7a815a..a8c1b65db0 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -1900,6 +1900,7 @@ extern int git_parse_maybe_bool(const char *);
> extern int git_config_int(const char *, const char *);
> extern int64_t git_config_int64(const char *, const char *);
> extern unsigned long git_config_ulong(const char *, const char *);
> +extern size_t git_config_size_t(const char *, const char *);
> extern int git_config_bool_or_int(const char *, const char *, int *);
> extern int git_config_bool(const char *, const char *);
> extern int git_config_maybe_bool(const char *, const char *);
> diff --git a/config.c b/config.c
> index 1a4d85537b..7b706cf27a 100644
> --- a/config.c
> +++ b/config.c
> @@ -834,6 +834,15 @@ int git_parse_ulong(const char *value, unsigned long *ret)
> return 1;
> }
>
> +static size_t git_parse_size_t(const char *value, unsigned long *ret)
> +{
> + size_t tmp;
> + if (!git_parse_signed(value, &tmp, maximum_unsigned_value_of_type(size_t)))I am getting these:
config.c:840:2: error: pointer targets in passing argument 2 of 'git_parse_signed' differ in signedness [-Werror=pointer-sign] if (!git_parse_signed(value, &tmp, maximum_unsigned_value_of_type(size_t))) ^
config.c:753:12: note: expected 'intmax_t *' but argument is of type 'size_t *'
static int git_parse_signed(const char *value, intmax_t *ret, intmax_t max)
^Changing "size_t tmp" to "intmax_t tmp" squelches it but the maximum unsigned value of size_t type would probably overflow "intmax_t max" which is signed, so...