From: ggn Date: Tue, 13 Sep 2016 08:59:38 +0000 (+0300) Subject: Fixed bug when expanding macros with comments that have @, \, etc. X-Git-Tag: v2.1.0~151 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=commitdiff_plain;h=be5c1cb1a3ca24f29789437675fa8cd22e1edd45;hp=9d0b53158275f8f9f542fb4d4a873d54789fe027 Fixed bug when expanding macros with comments that have @, \, etc. Signed-off-by: Shamus Hammons --- diff --git a/token.c b/token.c index 4067711..124179f 100644 --- a/token.c +++ b/token.c @@ -314,6 +314,11 @@ int ExpandMacro(char * src, char * dest, int destsiz) if (dst >= edst) goto overflow; + // Skip comments in case a loose @ or \ is in there + // In that case the tokeniser was trying to expand it. + if (*s == '*' || *s == ';' || ((*s == '/') && (*(s + 1) == '/'))) + goto skipcomments; + *dst++ = *s++; } // Do macro expansion @@ -604,6 +609,8 @@ strcopy: } } +skipcomments: + *dst = EOS; DEBUG { printf("ExM: dst=\"%s\"\n", dest); } return OK;