Jacek Caban : jscript: Moved skipping spaces to separated function.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Sep 30 14:28:29 CDT 2014


Module: wine
Branch: master
Commit: 77d0c2a44c72cef6fe23351cbe7b473cd3e9b9c5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=77d0c2a44c72cef6fe23351cbe7b473cd3e9b9c5

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Sep 30 16:51:44 2014 +0200

jscript: Moved skipping spaces to separated function.

---

 dlls/jscript/lex.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/dlls/jscript/lex.c b/dlls/jscript/lex.c
index 8d8e2d9..5e0226a 100644
--- a/dlls/jscript/lex.c
+++ b/dlls/jscript/lex.c
@@ -231,6 +231,16 @@ static BOOL skip_comment(parser_ctx_t *ctx)
     return TRUE;
 }
 
+static BOOL skip_spaces(parser_ctx_t *ctx)
+{
+    while(ctx->ptr < ctx->end && isspaceW(*ctx->ptr)) {
+        if(is_endline(*ctx->ptr++))
+            ctx->nl = TRUE;
+    }
+
+    return ctx->ptr != ctx->end;
+}
+
 static BOOL unescape(WCHAR *str)
 {
     WCHAR *pd, *p, c;
@@ -534,11 +544,7 @@ static BOOL parse_numeric_literal(parser_ctx_t *ctx, double *ret)
 static int next_token(parser_ctx_t *ctx, void *lval)
 {
     do {
-        while(ctx->ptr < ctx->end && isspaceW(*ctx->ptr)) {
-            if(is_endline(*ctx->ptr++))
-                ctx->nl = TRUE;
-        }
-        if(ctx->ptr == ctx->end)
+        if(!skip_spaces(ctx))
             return tEOF;
     }while(skip_comment(ctx) || skip_html_comment(ctx));
 




More information about the wine-cvs mailing list