Skip to content

Commit

Permalink
sunrpc/cache.h: fix coding style
Browse files Browse the repository at this point in the history
Neaten code style in get_int().
Also use sizeof() instead of hard coded number as suggested by
Joe Perches <joe@perches.com>.

Cc: Joe Perches <joe@perches.com>
Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
Eldad Zack authored and J. Bruce Fields committed Jul 11, 2012
1 parent 7f2e7dc commit d9c2ede
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions include/linux/sunrpc/cache.h
Original file line number Diff line number Diff line change
@@ -219,11 +219,17 @@ static inline int get_int(char **bpp, int *anint)
char buf[50];
char *ep;
int rv;
int len = qword_get(bpp, buf, 50);
if (len < 0) return -EINVAL;
if (len ==0) return -ENOENT;
int len = qword_get(bpp, buf, sizeof(buf));

if (len < 0)
return -EINVAL;
if (len == 0)
return -ENOENT;

rv = simple_strtol(buf, &ep, 0);
if (*ep) return -EINVAL;
if (*ep)
return -EINVAL;

*anint = rv;
return 0;
}

0 comments on commit d9c2ede

Please sign in to comment.