| To: | Dave Chinner <david@xxxxxxxxxxxxx> |
|---|---|
| Subject: | Re: [PATCH 12/15] mkfs: merge getnum |
| From: | Christoph Hellwig <hch@xxxxxxxxxxxxx> |
| Date: | Mon, 2 Dec 2013 09:22:33 -0800 |
| Cc: | xfs@xxxxxxxxxxx |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <1385689430-10103-13-git-send-email-david@xxxxxxxxxxxxx> |
| References: | <1385689430-10103-1-git-send-email-david@xxxxxxxxxxxxx> <1385689430-10103-13-git-send-email-david@xxxxxxxxxxxxx> |
| User-agent: | Mutt/1.5.21 (2010-09-15) |
On Fri, Nov 29, 2013 at 12:43:47PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
>
> getnum() is now only called by getnum_checked(). Move the two
> together into a single getnum() function and change all the callers
> back to getnum().
So we now have two different getnums in mkfs now. Maybe the one in
proto.c should have a different name?
> +static long long
> +getnum(
> + const char *str,
> + unsigned int blksize,
> + unsigned int sectsize,
> + bool convert)
> +{
> + long long i;
> + char *sp;
> +
> + if (convert)
> + return cvtnum(blksize, sectsize, str);
Also the whole if convert is true sillyness lives on here. The caller
that wants cvtnum should just call it directly.
> + else {
> + char *sp;
> +
> + c = strtoll(str, &sp, 0);
> + if (c == 0 && sp == str)
> + illegal_option(str, opts, index);
> + if (*sp != '\0')
> + illegal_option(str, opts, index);
> + }
And given that the strtoll wrapping code is the same for both getnums
I suspect we shoud just have a mkfs_strtoll that gets called here,
and directly by the proto.c callers.
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH 11/15] mkfs: table based parsing for converted parameters, Christoph Hellwig |
|---|---|
| Next by Date: | Re: [PATCH 13/15] mkfs: encode conflicts into parsing table, Christoph Hellwig |
| Previous by Thread: | Re: [PATCH 11/15] mkfs: table based parsing for converted parameters, Christoph Hellwig |
| Next by Thread: | Re: [PATCH 12/15] mkfs: merge getnum, Dave Chinner |
| Indexes: | [Date] [Thread] [Top] [All Lists] |