Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176371
b: refs/heads/master
c: 922ac25
h: refs/heads/master
i:
  176369: 935074a
  176367: f3304b5
v: v3
  • Loading branch information
André Goddard Rosa authored and Linus Torvalds committed Dec 15, 2009
1 parent 9b5db34 commit 6419f07
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 35 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: c5484d7c0a533de6198cb474097e33b174f9c565
refs/heads/master: 922ac25c9f4b5dc4c48ff12bfd14a98bdeb6ff0a
48 changes: 14 additions & 34 deletions trunk/lib/vsprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ static unsigned int simple_guess_base(const char *cp)
}

/**
* simple_strtoul - convert a string to an unsigned long
* simple_strtoull - convert a string to an unsigned long long
* @cp: The start of the string
* @endp: A pointer to the end of the parsed string will be placed here
* @base: The number base to use
*/
unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base)
unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base)
{
unsigned long result = 0;
unsigned long long result = 0;

if (!base)
base = simple_guess_base(cp);
Expand All @@ -76,54 +76,34 @@ unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base)

return result;
}
EXPORT_SYMBOL(simple_strtoul);
EXPORT_SYMBOL(simple_strtoull);

/**
* simple_strtol - convert a string to a signed long
* simple_strtoul - convert a string to an unsigned long
* @cp: The start of the string
* @endp: A pointer to the end of the parsed string will be placed here
* @base: The number base to use
*/
long simple_strtol(const char *cp, char **endp, unsigned int base)
unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base)
{
if (*cp == '-')
return -simple_strtoul(cp + 1, endp, base);

return simple_strtoul(cp, endp, base);
return simple_strtoull(cp, endp, base);
}
EXPORT_SYMBOL(simple_strtol);
EXPORT_SYMBOL(simple_strtoul);

/**
* simple_strtoull - convert a string to an unsigned long long
* simple_strtol - convert a string to a signed long
* @cp: The start of the string
* @endp: A pointer to the end of the parsed string will be placed here
* @base: The number base to use
*/
unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base)
long simple_strtol(const char *cp, char **endp, unsigned int base)
{
unsigned long long result = 0;

if (!base)
base = simple_guess_base(cp);

if (base == 16 && cp[0] == '0' && TOLOWER(cp[1]) == 'x')
cp += 2;

while (isxdigit(*cp)) {
unsigned int value;

value = isdigit(*cp) ? *cp - '0' : TOLOWER(*cp) - 'a' + 10;
if (value >= base)
break;
result = result * base + value;
cp++;
}
if (endp)
*endp = (char *)cp;
if (*cp == '-')
return -simple_strtoul(cp + 1, endp, base);

return result;
return simple_strtoul(cp, endp, base);
}
EXPORT_SYMBOL(simple_strtoull);
EXPORT_SYMBOL(simple_strtol);

/**
* simple_strtoll - convert a string to a signed long long
Expand Down

0 comments on commit 6419f07

Please sign in to comment.