Mercurial > ~dholland > hg > tradcpp > index.cgi
comparison 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 |
comparison
equal
deleted
inserted
replaced
126:cb08e397ce7b | 127:a0a86380456e |
---|---|
182 oldlen = strlen(expr); | 182 oldlen = strlen(expr); |
183 uncomment(expr); | 183 uncomment(expr); |
184 /* trim to fit, so the malloc debugging won't complain */ | 184 /* trim to fit, so the malloc debugging won't complain */ |
185 expr = dorealloc(expr, oldlen + 1, strlen(expr) + 1); | 185 expr = dorealloc(expr, oldlen + 1, strlen(expr) + 1); |
186 | 186 |
187 val = eval(&p3, expr); | 187 if (ifstate->curtrue) { |
188 val = eval(&p3, expr); | |
189 } else { | |
190 val = 0; | |
191 } | |
188 ifstate_push(p, val); | 192 ifstate_push(p, val); |
189 dostrfree(expr); | 193 dostrfree(expr); |
190 } | 194 } |
191 | 195 |
192 static | 196 static |