projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
hwmon: add support for JEDEC JC 42.4 compliant temperature sensors
[firefly-linux-kernel-4.4.55.git]
/
lib
/
vsprintf.c
diff --git
a/lib/vsprintf.c
b/lib/vsprintf.c
index 4ee19d0d3910b36ad15f88688db46d5d1249fa61..7af9d841c43beea318540340739ac3432b87ed12 100644
(file)
--- a/
lib/vsprintf.c
+++ b/
lib/vsprintf.c
@@
-146,19
+146,16
@@
int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)
{
char *tail;
unsigned long val;
{
char *tail;
unsigned long val;
- size_t len;
*res = 0;
*res = 0;
- len = strlen(cp);
- if (len == 0)
+ if (!*cp)
return -EINVAL;
val = simple_strtoul(cp, &tail, base);
if (tail == cp)
return -EINVAL;
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;
}
*res = val;
return 0;
}
@@
-220,18
+217,15
@@
int strict_strtoull(const char *cp, unsigned int base, unsigned long long *res)
{
char *tail;
unsigned long long val;
{
char *tail;
unsigned long long val;
- size_t len;
*res = 0;
*res = 0;
- len = strlen(cp);
- if (len == 0)
+ if (!*cp)
return -EINVAL;
val = simple_strtoull(cp, &tail, base);
if (tail == cp)
return -EINVAL;
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;
}
*res = val;
return 0;
}