From 96d37ecb22d847499fbfab80c62894b64249b8c4 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Thu, 30 Jun 2016 10:15:07 -0400 Subject: Improve r_force_number coding style. --- node.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'node.c') 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])) -- cgit v1.2.3