Re: [PATCH 2/2] sunrpc/cache.h: replace simple_strtoul

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

 



On Thu, 2012-07-05 at 01:00 +0200, Eldad Zack wrote:
> This patch replaces the usage of simple_strtoul with kstrtoint in
> get_int().

Just some trivia:

> diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
[]
> @@ -217,7 +217,7 @@ extern int qword_get(char **bpp, char *dest, int bufsize);
>  static inline int get_int(char **bpp, int *anint)
>  {
>  	char buf[50];
> -	char *ep;
> +	ssize_t ret;
>  	int rv;
>  	int len = qword_get(bpp, buf, 50);

This would be nicer as
	int len = qword_get(bpp, buf, sizeof(buf));

> @@ -226,8 +226,8 @@ static inline int get_int(char **bpp, int *anint)
>  	if (len == 0)
>  		return -ENOENT;
>  
> -	rv = simple_strtol(buf, &ep, 0);
> -	if (*ep)
> +	ret = kstrtoint(buf, 0, &rv);
> +	if (ret)
>  		return -EINVAL;
>  
>  	*anint = rv;

ret and rv aren't useful anymore.

Perhaps:

	if (kstrtoint(buf, 0, anint))
		return -EINVAL;

	return 0;


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux