From: "Shawn O. Pearce" <spearce@spearce.org>
To: David Bryson <david@statichacks.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Use "git_config_string" to simplify "builtin-gc.c" code where "prune_expire" is set
Date: Tue, 30 Sep 2008 13:04:23 -0700 [thread overview]
Message-ID: <20080930200423.GL21310@spearce.org> (raw)
In-Reply-To: <20080930195355.GA14499@eratosthenes.cryptobackpack.org>
David Bryson <david@statichacks.org> 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.
next prev parent reply other threads:[~2008-09-30 20:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-30 19:05 [PATCH] Use "git_config_string" to simplify "builtin-gc.c" code where "prune_expire" is set David Bryson
2008-09-30 19:37 ` Shawn O. Pearce
2008-09-30 19:53 ` David Bryson
2008-09-30 20:04 ` Shawn O. Pearce [this message]
2008-09-30 20:28 ` David Bryson
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=20080930200423.GL21310@spearce.org \
--to=spearce@spearce.org \
--cc=david@statichacks.org \
--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).