diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-10-19 22:12:06 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-10-19 22:13:34 -0700 |
commit | ec03301eb4e6137bd58fb56defc7346bdfec6991 (patch) | |
tree | c74b072c3793298aba8d2e5b754b6e3aefa0f03e | |
parent | ca544db4b6de0cb994a2eef65cc2e5e47079254b (diff) | |
download | nasm-ec03301eb4e6137bd58fb56defc7346bdfec6991.tar.gz |
preproc: fix exit conditions for indirection loop
When locating the end of a %[...] construct, we need to end up with
the pointer pointing to the terminating character.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | preproc.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -810,26 +810,25 @@ static Token *tokenize(char *line) int lvl = 1; line += 2; /* Skip the leading %[ */ p++; - while (lvl && (c = *p)) { + while (lvl && (c = *p++)) { switch (c) { case ']': lvl--; break; case '%': - p++; if (*p == '[') lvl++; break; case '\'': case '\"': case '`': - p = nasm_skip_string(p); + p = nasm_skip_string(p)+1; break; default: break; } - p++; } + p--; if (*p) *p++ = '\0'; type = TOK_INDIRECT; |