From 6d4dd5ae3b12c429921039ce2a5b354e7ef3e532 Mon Sep 17 00:00:00 2001 From: nog Date: Wed, 23 Jul 2008 14:45:30 +0200 Subject: [PATCH] Fix macro argument replacements When searching for macro arguments to replace, make sure that the argument is not the begining of another identifier. --- ivlpp/lexor.lex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ivlpp/lexor.lex b/ivlpp/lexor.lex index 7e4796047..58b1d069b 100644 --- a/ivlpp/lexor.lex +++ b/ivlpp/lexor.lex @@ -858,6 +858,7 @@ static int define_continue_flag = 0; static char *find_arg(char*ptr, char*head, char*arg) { char *cp = ptr; + size_t len = strlen(arg); while (1) { /* Look for a candidate match, just return if none is found. */ @@ -868,7 +869,8 @@ static char *find_arg(char*ptr, char*head, char*arg) * match is not in the middle of another identifier. */ if (cp != head && - (isalnum(*(cp-1)) || *(cp-1) == '_' || *(cp-1) == '$')) { + (isalnum(*(cp-1)) || *(cp-1) == '_' || *(cp-1) == '$' || + isalnum(*(cp+len)) || *(cp+len) == '_' || *(cp+len) == '$')) { cp++; continue; }