toke.c, scan_ident: No need for a while loop when using PEEKSPACE
authorBrian Fraser <fraserbn@gmail.com>
Wed, 18 Sep 2013 08:20:43 +0000 (05:20 -0300)
committerBrian Fraser <fraserbn@gmail.com>
Wed, 18 Sep 2013 08:24:43 +0000 (05:24 -0300)
PEEKSPACE already gobbles up all the remaining spaces until it
either finds a non-space character, or EOF.

toke.c

diff --git a/toke.c b/toke.c
index 682fe67..9d75cc0 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -9418,7 +9418,7 @@ S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni)
        bracket = s;
        s++;
        orig_copline = CopLINE(PL_curcop);
-        while (s < PL_bufend && isSPACE(*s)) {
+        if (s < PL_bufend && isSPACE(*s)) {
             s = PEEKSPACE(s);
         }
     }
@@ -9478,7 +9478,7 @@ S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni)
         parse_ident(&s, &d, e, 1, is_utf8);
            *d = '\0';
             tmp_copline = CopLINE(PL_curcop);
-            while (s < PL_bufend && isSPACE(*s)) {
+            if (s < PL_bufend && isSPACE(*s)) {
                 s = PEEKSPACE(s);
             }
            if ((*s == '[' || (*s == '{' && strNE(dest, "sub")))) {
@@ -9517,7 +9517,7 @@ S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni)
 
         if ( !tmp_copline )
             tmp_copline = CopLINE(PL_curcop);
-        while (s < PL_bufend && isSPACE(*s)) {
+        if (s < PL_bufend && isSPACE(*s)) {
             s = PEEKSPACE(s);
         }