aboutsummaryrefslogtreecommitdiffstats
path: root/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'node.c')
-rw-r--r--node.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/node.c b/node.c
index 8c5d0c04..bb2fe437 100644
--- a/node.c
+++ b/node.c
@@ -78,15 +78,13 @@ r_force_number(NODE *n)
n->numbr = 0.0;
/* Trim leading white space, bailing out if there's nothing else */
- cp = n->stptr;
- cpend = cp + n->stlen;
- while (1) {
- if (cp == cpend)
- goto badnum;
- if (!isspace((unsigned char) *cp))
- break;
- cp++;
- }
+ for (cp = n->stptr, cpend = cp + n->stlen;
+ cp < cpend && isspace((unsigned char) *cp); cp++)
+ continue;
+
+ if (cp == cpend)
+ goto badnum;
+
/* At this point, we know the string is not entirely white space */
/* Trim trailing white space */
while (isspace((unsigned char) cpend[-1]))