summaryrefslogtreecommitdiff
path: root/strings/strto.c
diff options
context:
space:
mode:
Diffstat (limited to 'strings/strto.c')
-rw-r--r--strings/strto.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/strings/strto.c b/strings/strto.c
index 84dccbcbeb8..c98b19a7e67 100644
--- a/strings/strto.c
+++ b/strings/strto.c
@@ -103,6 +103,7 @@ function (const char *nptr,char **endptr,int base)
}
/* Check for a sign. */
+ negative= 0;
if (*s == '-')
{
negative = 1;
@@ -110,11 +111,9 @@ function (const char *nptr,char **endptr,int base)
}
else if (*s == '+')
{
- negative = 0;
++s;
}
- else
- negative = 0;
+
if (base == 16 && s[0] == '0' && toupper (s[1]) == 'X')
s += 2;