]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
linecounting fix for push/pop(line) pragmas
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 25 Nov 2012 17:13:46 +0000 (18:13 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 25 Nov 2012 17:13:46 +0000 (18:13 +0100)
lexer.c

diff --git a/lexer.c b/lexer.c
index 175d158023dfe47c7a482723af5fbca0b34c1947..17af7b6f4b92ad7ca30c2da8bd4f5a2161afbb7b 100644 (file)
--- a/lexer.c
+++ b/lexer.c
@@ -445,7 +445,8 @@ static bool lex_try_pragma(lex_file *lex)
     if (!strcmp(command, "push")) {
         if (!strcmp(param, "line")) {
             lex->push_line++;
-            --line;
+            if (lex->push_line == 1)
+                --line;
         }
         else
             goto unroll;
@@ -454,7 +455,8 @@ static bool lex_try_pragma(lex_file *lex)
         if (!strcmp(param, "line")) {
             if (lex->push_line)
                 lex->push_line--;
-            --line;
+            if (lex->push_line == 0)
+                --line;
         }
         else
             goto unroll;