Mercurial > hg > Members > innparusu > Gears
changeset 135:9ae7ce6c83f5
Fix segmentation falt
author | innparusu |
---|---|
date | Thu, 29 Sep 2016 17:18:15 +0900 |
parents | 36ac17d37be4 |
children | c7ac153f86dd |
files | src/parallel_execution/rb_tree.c |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/rb_tree.c Thu Sep 29 16:58:23 2016 +0900 +++ b/src/parallel_execution/rb_tree.c Thu Sep 29 17:18:15 2016 +0900 @@ -109,15 +109,15 @@ context->data[Traverse]->traverse.newNode); } -__code insertCase1(struct Context* context, struct Node* parent) { - if (parent!=NULL) { +__code insertCase1(struct Context* context, struct Element* nodeStack) { + if (nodeStack!=NULL) { goto meta(context, InsertCase2); } goto meta(context, StackClear); } __code insert1_stub(struct Context* context) { - goto insertCase1(context, (struct Node*)context->data[Traverse]->traverse.nodeStack->data); + goto insertCase1(context, context->data[Traverse]->traverse.nodeStack); } __code insertCase2(struct Context* context, struct Node* parent) { @@ -281,7 +281,7 @@ allocator(context); struct Element* element = &context->data[context->dataNum]->element; goto rotateLeft(context, - &context->data[Node]->node, + context->data[Traverse]->traverse.current, &context->data[Tree]->tree, &context->data[Traverse]->traverse, parent, @@ -310,15 +310,18 @@ } __code rotateRight_stub(struct Context* context) { + struct Traverse* traverse = &context->data[Traverse]->traverse; + struct Node* parent = (traverse->nodeStack)?(struct Node*)traverse->nodeStack->data:NULL; + traverse->nodeStack = traverse->nodeStack->next; struct Allocate* allocate = &context->data[Allocate]->allocate; allocate->size = sizeof(struct Element); allocator(context); struct Element* element = &context->data[context->dataNum]->element; goto rotateRight(context, - &context->data[Node]->node, + context->data[Traverse]->traverse.current, &context->data[Tree]->tree, &context->data[Traverse]->traverse, - context->data[Traverse]->traverse.current, + parent, element); }