Fix macro argument replacements
When searching for macro arguments to replace, make sure that the argument is not the begining of another identifier.
This commit is contained in:
parent
6cb3d86d15
commit
6d4dd5ae3b
|
|
@ -858,6 +858,7 @@ static int define_continue_flag = 0;
|
||||||
static char *find_arg(char*ptr, char*head, char*arg)
|
static char *find_arg(char*ptr, char*head, char*arg)
|
||||||
{
|
{
|
||||||
char *cp = ptr;
|
char *cp = ptr;
|
||||||
|
size_t len = strlen(arg);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
/* Look for a candidate match, just return if none is found. */
|
/* 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.
|
* match is not in the middle of another identifier.
|
||||||
*/
|
*/
|
||||||
if (cp != head &&
|
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++;
|
cp++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue