mirror of
https://github.com/cc65/cc65.git
synced 2025-01-12 02:30:44 +00:00
Free expression trees when they're no longer needed
git-svn-id: svn://svn.cc65.org/cc65/trunk@2594 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
929b9c174a
commit
64c5165a5b
@ -923,18 +923,24 @@ long ConstExpression (void)
|
|||||||
* not constant.
|
* not constant.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
long Val;
|
||||||
|
|
||||||
/* Read the expression, and call finalize (exception here, since we
|
/* Read the expression, and call finalize (exception here, since we
|
||||||
* expect a const).
|
* expect a const).
|
||||||
*/
|
*/
|
||||||
ExprNode* Expr = FinalizeExpr (Expression ());
|
ExprNode* Expr = FinalizeExpr (Expression ());
|
||||||
|
|
||||||
/* Return the value */
|
/* Get the value */
|
||||||
if (IsConstExpr (Expr)) {
|
if (IsConstExpr (Expr)) {
|
||||||
return GetExprVal (Expr);
|
Val = GetExprVal (Expr);
|
||||||
} else {
|
} else {
|
||||||
Error (ERR_CONSTEXPR_EXPECTED);
|
Error (ERR_CONSTEXPR_EXPECTED);
|
||||||
return 0;
|
Val = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Free the expression tree and return the value */
|
||||||
|
FreeExpr (Expr);
|
||||||
|
return Val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1644,4 +1650,4 @@ void WriteExpr (ExprNode* Expr)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -370,6 +370,9 @@ void SegCheck (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We don't need the expression tree any longer */
|
||||||
|
FreeExpr (F->V.Expr);
|
||||||
|
|
||||||
/* Convert the fragment into a literal fragment */
|
/* Convert the fragment into a literal fragment */
|
||||||
for (I = 0; I < F->Len; ++I) {
|
for (I = 0; I < F->Len; ++I) {
|
||||||
F->V.Data [I] = Val & 0xFF;
|
F->V.Data [I] = Val & 0xFF;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user