summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-10-19 22:12:06 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-10-19 22:13:34 -0700
commitec03301eb4e6137bd58fb56defc7346bdfec6991 (patch)
treec74b072c3793298aba8d2e5b754b6e3aefa0f03e
parentca544db4b6de0cb994a2eef65cc2e5e47079254b (diff)
downloadnasm-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.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/preproc.c b/preproc.c
index 434383b5..0b7ec1c8 100644
--- a/preproc.c
+++ b/preproc.c
@@ -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;