Fixed an error in the special purpose allocator in expr.c.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5109 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
1df46aed11
commit
ca0877adb6
1 changed files with 6 additions and 4 deletions
|
@ -94,10 +94,11 @@ static ExprNode* NewExprNode (unsigned Op)
|
||||||
ExprNode* N;
|
ExprNode* N;
|
||||||
|
|
||||||
/* Do we have some nodes in the list already? */
|
/* Do we have some nodes in the list already? */
|
||||||
if (FreeExprNodes) {
|
if (FreeNodeCount) {
|
||||||
/* Use first node from list */
|
/* Use first node from list */
|
||||||
N = FreeExprNodes;
|
N = FreeExprNodes;
|
||||||
FreeExprNodes = N->Left;
|
FreeExprNodes = N->Left;
|
||||||
|
--FreeNodeCount;
|
||||||
} else {
|
} else {
|
||||||
/* Allocate fresh memory */
|
/* Allocate fresh memory */
|
||||||
N = xmalloc (sizeof (ExprNode));
|
N = xmalloc (sizeof (ExprNode));
|
||||||
|
@ -124,6 +125,7 @@ static void FreeExprNode (ExprNode* E)
|
||||||
/* Remember this node for later */
|
/* Remember this node for later */
|
||||||
E->Left = FreeExprNodes;
|
E->Left = FreeExprNodes;
|
||||||
FreeExprNodes = E;
|
FreeExprNodes = E;
|
||||||
|
++FreeNodeCount;
|
||||||
} else {
|
} else {
|
||||||
/* Free the memory */
|
/* Free the memory */
|
||||||
xfree (E);
|
xfree (E);
|
||||||
|
@ -1016,7 +1018,7 @@ static ExprNode* Factor (void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (LooseCharTerm && CurTok.Tok == TOK_STRCON &&
|
if (LooseCharTerm && CurTok.Tok == TOK_STRCON &&
|
||||||
SB_GetLen (&CurTok.SVal) == 1) {
|
SB_GetLen (&CurTok.SVal) == 1) {
|
||||||
/* A character constant */
|
/* A character constant */
|
||||||
N = GenLiteralExpr (TgtTranslateChar (SB_At (&CurTok.SVal, 0)));
|
N = GenLiteralExpr (TgtTranslateChar (SB_At (&CurTok.SVal, 0)));
|
||||||
|
@ -1471,8 +1473,8 @@ void FreeExpr (ExprNode* Root)
|
||||||
{
|
{
|
||||||
if (Root) {
|
if (Root) {
|
||||||
FreeExpr (Root->Left);
|
FreeExpr (Root->Left);
|
||||||
FreeExpr (Root->Right);
|
FreeExpr (Root->Right);
|
||||||
FreeExprNode (Root);
|
FreeExprNode (Root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue