Re: [PATCH] Use "git_config_string" to simplify "builtin-gc.c" code where "prune_expire" is set

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

 



David Bryson <david@xxxxxxxxxxxxxxx> wrote:
> diff --git a/builtin-gc.c b/builtin-gc.c
> index fac200e..6260652 100644
> --- a/builtin-gc.c
> +++ b/builtin-gc.c
> @@ -57,15 +57,12 @@ static int gc_config(const char *var, const char *value, void *cb)
>  		return 0;
>  	}
>  	if (!strcmp(var, "gc.pruneexpire")) {
> -		if (!value)
> -			return config_error_nonbool(var);
> -		if (strcmp(value, "now")) {
> +		if (value && strcmp(value, "now")) {
>  			unsigned long now = approxidate("now");
>  			if (approxidate(value) >= now)
>  				return error("Invalid %s: '%s'", var, value);
>  		}
> -		prune_expire = xstrdup(value);
> -		return 0;
> +		return git_config_string(&prune_expire, var, value);

The message formatting was a lot better.  But:

builtin-gc.c:65: warning: passing argument 1 of 'git_config_string' from incompatible pointer type

>From http://git.or.cz/gitwiki/Janitor:

  This is because the first argument to "git_config_string" should
  be a "const char **", not a "char **". There will be a compile
  time warning if a "char **" is passed instead of a "const char **"
  and the patch will be rejected. (And no, casting the "char **"
  into a "const char **" is not a good solution either.)"

-- 
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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