mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-07 18:01:30 +00:00
[qfcc] Count terms correctly
Parentheses confused the term counting because they weren't taken into account for the "neither expression can be split" check, resulting in a later segfault due to walking off the end of the array.
This commit is contained in:
parent
7dc1ab0ea8
commit
df04a37a8c
1 changed files with 1 additions and 1 deletions
|
@ -454,7 +454,7 @@ count_terms (const expr_t *expr)
|
|||
}
|
||||
auto e1 = expr->expr.e1;
|
||||
auto e2 = expr->expr.e2;
|
||||
int terms = !is_sum (e1) + !is_sum (e2);
|
||||
int terms = (!is_sum (e1) || e1->paren) + (!is_sum (e2) || e2->paren);
|
||||
if (!e1->paren && is_sum (e1)) {
|
||||
terms += count_terms (expr->expr.e1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue