fix GC safety bugs in leftRotate and rightRotate

This commit is contained in:
Joel Dice 2008-04-11 18:05:03 -06:00
parent 7eef2e7918
commit 31e5e4c286

View File

@ -104,6 +104,8 @@ treeFind(Thread* t, object old, object node, object sentinal,
object
leftRotate(Thread* t, object n)
{
PROTECT(t, n);
object child = cloneTreeNode(t, treeNodeRight(t, n));
set(t, n, TreeNodeRight, treeNodeLeft(t, child));
set(t, child, TreeNodeLeft, n);
@ -113,6 +115,8 @@ leftRotate(Thread* t, object n)
object
rightRotate(Thread* t, object n)
{
PROTECT(t, n);
object child = cloneTreeNode(t, treeNodeLeft(t, n));
set(t, n, TreeNodeLeft, treeNodeRight(t, child));
set(t, child, TreeNodeRight, n);