# HG changeset patch # User Shinji KONO # Date 1478654011 -32400 # Node ID c13b07d15d86c9502611403c63c83908ae367a1d # Parent 04a2f486a30d1af6e5afacb7825dffd89f48ae56 fix diff -r 04a2f486a30d -r c13b07d15d86 src/parallel_execution/rb_tree.c --- a/src/parallel_execution/rb_tree.c Tue Nov 08 19:39:40 2016 +0900 +++ b/src/parallel_execution/rb_tree.c Wed Nov 09 10:13:31 2016 +0900 @@ -112,9 +112,12 @@ context->data[Traverse]->traverse.newNode); } -__code insertCase1(struct Context* context, struct Tree* tree, struct SingleLinkedStack* nodeStack) { - if (nodeStack->top != NULL) { - goto meta(context, InsertCase2); +__code insertCase1(struct Context* context,struct Traverse* traverse, struct Tree* tree, struct Stack* nodeStack) { + struct SingleLinkedStack* stack = (struct SingleLinkedStack*)traverse->nodeStack->stack; + if (stack->top != NULL) { + nodeStack->stack = (union Data*)traverse->nodeStack; + nodeStack->next = InsertCase2; + goto meta(context, traverse->nodeStack->get); } tree->root->color = Black; goto meta(context, StackClear); @@ -122,8 +125,9 @@ __code insert1_stub(struct Context* context) { goto insertCase1(context, + &context->data[Traverse]->traverse, &context->data[Tree]->tree, - &context->data[Traverse]->traverse.nodeStack->stack->singleLinkedStack); + &context->data[Stack]->stack); } __code insertCase2(struct Context* context, struct Traverse* traverse, struct Stack* nodeStack, struct Node* parent) { @@ -180,13 +184,13 @@ traverse->rotateNext = InsertCase5; nodeStack->stack = (union Data*)traverse->nodeStack; nodeStack->next = RotateL; - goto meta(context, nodeStack->get); + goto meta(context, nodeStack->pop); } else if ((current == parent->left) && (parent == grandparent->right)) { traverse->current = traverse->current->right; traverse->rotateNext = InsertCase5; nodeStack->stack = (union Data*)traverse->nodeStack; nodeStack->next = RotateR; - goto meta(context, nodeStack->get); + goto meta(context, nodeStack->pop); } traverse->current = current; @@ -203,7 +207,7 @@ struct Stack* nodeStack = traverse->nodeStack; nodeStack->stack = (union Data*)traverse->nodeStack; nodeStack->next = InsertCase51; - goto meta(context, nodeStack->pop2); + goto meta(context, nodeStack->get2); } __code insert5_stub(struct Context* context) {