Mercurial > ~dholland > hg > tradcpp > index.cgi
diff directive.c @ 127:a0a86380456e
fix for #if handling:
Don't eval the control expression of the first #if of a block when
already in a false block; it might not be valid. Reported by
Baptiste Daroussin.
author | David A. Holland |
---|---|
date | Wed, 12 Jun 2013 10:52:56 -0400 |
parents | 4483a14ee101 |
children | 1cda505ddc78 |
line wrap: on
line diff
--- a/directive.c Wed Jun 12 10:51:10 2013 -0400 +++ b/directive.c Wed Jun 12 10:52:56 2013 -0400 @@ -184,7 +184,11 @@ /* trim to fit, so the malloc debugging won't complain */ expr = dorealloc(expr, oldlen + 1, strlen(expr) + 1); - val = eval(&p3, expr); + if (ifstate->curtrue) { + val = eval(&p3, expr); + } else { + val = 0; + } ifstate_push(p, val); dostrfree(expr); }