Re: [PATCH 12/15] mkfs: merge getnum

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

 



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.

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux