Re: [PATCH 2/2] teach git-config to output large integers
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Aug 20, 2013, 22:57 UTC
- Message-ID
- <20130820225745.GL4110@google.com>
- In-Reply-To
- <20130820224710.GB24766@sigill.intra.peff.net>
Jeff King wrote:
> I kind of hate the name "--ulong". I wanted to call it "--size" or > something and abstract away the actual platform representation, and just > make it "big enough for file sizes".
Yes, something like --size would be more pleasant.
It could still use unsigned long internally. My only worry about --size is that it does not make it clear we are talking about file sizes and not in-memory sizes (size_t), and I'm not too worried about that.
[...]
> --- a/builtin/config.c > +++ b/builtin/config.c
[...]
Show 9 quoted lines
> @@ -268,6 +272,10 @@ static char *normalize_value(const char *key, const char *value) > int v = git_config_int(key, value); > sprintf(normalized, "%d", v); > } > + else if (types == TYPE_ULONG) > + sprintf(normalized, "%lu", > + git_config_ulong(key, value)); > + > else if (types == TYPE_BOOL)
Style: uncuddled "else", stray blank line. (The former was already there, but it still stands out.) I think
if (types == TYPE_INT) {
...
} else if (types == TYPE_ULONG) {
...
} else if (types == TYPE_BOOL) {
...
} else if (types == TYPE_BOOL_OR_INT) {
...
} else {
...
}would be easiest to read.
Thanks for taking this on.
Sincerely, Jonathan