Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207332
b: refs/heads/master
c: 559b140
h: refs/heads/master
v: v3
  • Loading branch information
Michal Nazarewicz authored and Linus Torvalds committed Aug 10, 2010
1 parent a2df85f commit 9b6ad25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e3f76e3386ee38e3654e81c2f3933ccca1f2d639
refs/heads/master: 559b140a36613bb5b63f258b2ad833dad8cd11d9
14 changes: 4 additions & 10 deletions trunk/lib/vsprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,16 @@ int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)
{
char *tail;
unsigned long val;
size_t len;

*res = 0;
len = strlen(cp);
if (len == 0)
if (!*cp)
return -EINVAL;

val = simple_strtoul(cp, &tail, base);
if (tail == cp)
return -EINVAL;

if ((*tail == '\0') ||
((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {
if ((tail[0] == '\0') || (tail[0] == '\n' && tail[1] == '\0')) {
*res = val;
return 0;
}
Expand Down Expand Up @@ -220,18 +217,15 @@ int strict_strtoull(const char *cp, unsigned int base, unsigned long long *res)
{
char *tail;
unsigned long long val;
size_t len;

*res = 0;
len = strlen(cp);
if (len == 0)
if (!*cp)
return -EINVAL;

val = simple_strtoull(cp, &tail, base);
if (tail == cp)
return -EINVAL;
if ((*tail == '\0') ||
((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {
if ((tail[0] == '\0') || (tail[0] == '\n' && tail[1] == '\0')) {
*res = val;
return 0;
}
Expand Down

0 comments on commit 9b6ad25

Please sign in to comment.