aboutsummaryrefslogtreecommitdiffstats
path: root/int_array.c
diff options
context:
space:
mode:
Diffstat (limited to 'int_array.c')
-rw-r--r--int_array.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/int_array.c b/int_array.c
index e7913dea..937a91cf 100644
--- a/int_array.c
+++ b/int_array.c
@@ -128,7 +128,6 @@ is_integer(NODE *symbol, NODE *subs)
/* must be a STRING */
char *cp = subs->stptr, *cpend, *ptr;
- char save;
size_t len = subs->stlen;
if (len == 0 || (! isdigit((unsigned char) *cp) && *cp != '-'))
@@ -143,7 +142,8 @@ is_integer(NODE *symbol, NODE *subs)
if (len == 1 && *cp != '-') { /* single digit */
subs->numbr = (long) (*cp - '0');
if ((subs->flags & MAYBE_NUM) != 0) {
- subs->flags &= ~(MAYBE_NUM|STRING);
+ /* leave MAYBE_NUM set */
+ subs->flags &= ~STRING;
subs->flags |= NUMBER;
}
subs->flags |= (NUMCUR|NUMINT);
@@ -151,18 +151,16 @@ is_integer(NODE *symbol, NODE *subs)
}
cpend = cp + len;
- save = *cpend;
- *cpend = '\0';
errno = 0;
l = strtol(cp, & ptr, 10);
- *cpend = save;
if (errno != 0 || ptr != cpend)
return NULL;
subs->numbr = l;
if ((subs->flags & MAYBE_NUM) != 0) {
- subs->flags &= ~(MAYBE_NUM|STRING);
+ /* leave MAYBE_NUM set */
+ subs->flags &= ~STRING;
subs->flags |= NUMBER;
}
subs->flags |= NUMCUR;