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>
This commit is contained in:
H. Peter Anvin 2008-10-19 22:12:06 -07:00
parent ca544db4b6
commit ec03301eb4

View File

@ -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;