Skip to content

Commit

Permalink
Merge pull request #87 from dedmen/patch-2
Browse files Browse the repository at this point in the history
Don't evaluate macros in double quotes
  • Loading branch information
thojkooi committed Nov 18, 2018
2 parents 7e70b98 + 7942c07 commit 8b88b46
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/preprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,16 @@ char *constants_preprocess(struct constants *constants, char *source, int line,
while (true) {
// Non-tokens
start = ptr;
while (*ptr != 0 && !IS_MACRO_CHAR(*ptr))
ptr++;

while (*ptr != 0 && !IS_MACRO_CHAR(*ptr)) {
if (*ptr == '"') {
ptr++;
while (*ptr != 0 && *ptr != '"')
ptr++;
}
ptr++; //also skips ending "
}


if (ptr - start > 0) {
len += ptr - start;
result = (char *)safe_realloc(result, len + 1);
Expand Down

0 comments on commit 8b88b46

Please sign in to comment.