Re: [PATCH 2/2] Move unsigned long option parsing out of pack-objects.c
- From
Charles Bailey <charles@hashpling.org>
- Date
- Jun 21, 2015, 18:30 UTC
- Message-ID
- <20150621183026.GA7199@hashpling.org>
- In-Reply-To
- <1434911144-6781-3-git-send-email-charles@hashpling.org>
On Sun, Jun 21, 2015 at 07:25:44PM +0100, Charles Bailey wrote:
Show 27 quoted lines
> From: Charles Bailey <cbailey32@bloomberg.net>
>
> diff --git a/parse-options.c b/parse-options.c
> index 80106c0..101b649 100644
> --- a/parse-options.c
> +++ b/parse-options.c
> @@ -180,6 +180,23 @@ static int get_value(struct parse_opt_ctx_t *p,
> return opterror(opt, "expects a numerical value", flags);
> return 0;
>
> + case OPTION_MAGNITUDE:
> + if (unset) {
> + *(unsigned long *)opt->value = 0;
> + return 0;
> + }
> + if (opt->flags & PARSE_OPT_OPTARG && !p->opt) {
> + *(unsigned long *)opt->value = opt->defval;
> + return 0;
> + }
> + if (get_arg(p, opt, flags, &arg))
> + return -1;
> + if (!git_parse_ulong(arg, opt->value))
> + return opterror(opt,
> + "expects a integer value with an optional k/m/g suffix",
> + flags);
> + return 0;
> +Spotted after sending: s/expects a integer/expects an integer/