Mercurial > hg > GearsTemplate
changeset 127:fe1fbfec7d01
stack clear
author | kono |
---|---|
date | Thu, 29 Sep 2016 22:22:36 +0900 |
parents | c7ac153f86dd |
children | 53df6602530f |
files | src/parallel_execution/rb_tree.c |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/rb_tree.c Thu Sep 29 19:02:49 2016 +0900 +++ b/src/parallel_execution/rb_tree.c Thu Sep 29 22:22:36 2016 +0900 @@ -110,31 +110,32 @@ context->data[Traverse]->traverse.result); } -__code insertNode(struct Context* context, struct Traverse* traverse, struct Tree* tree, struct Node* node, struct Node* newNode) { +__code insertNode(struct Context* context, struct Traverse* traverse, struct Node* node, struct Node* newNode) { *newNode = *node; newNode->color = Red; traverse->current = newNode; - tree->root->color = Black; goto meta(context, InsertCase1); } __code insertNode_stub(struct Context* context) { goto insertNode(context, &context->data[Traverse]->traverse, - &context->data[Tree]->tree, &context->data[Node]->node, context->data[Traverse]->traverse.newNode); } -__code insertCase1(struct Context* context, struct Element* nodeStack) { +__code insertCase1(struct Context* context, struct Tree* tree,struct Element* nodeStack) { if (nodeStack!=NULL) { goto meta(context, InsertCase2); } + tree->root->color = Black; goto meta(context, StackClear); } __code insert1_stub(struct Context* context) { - goto insertCase1(context, context->data[Traverse]->traverse.nodeStack); + goto insertCase1(context, + &context->data[Tree]->tree, + context->data[Traverse]->traverse.nodeStack); } __code insertCase2(struct Context* context, struct Node* parent) { @@ -331,6 +332,7 @@ __code stackClear(struct Context* context, stack_ptr node_stack, struct Traverse* traverse) { traverse->current = 0; + traverse->nodeStack = NULL; goto meta(context, context->next); }