Mercurial > hg > GearsTemplate
changeset 137:909d0548284f
fix stackClear
author | mir3636 |
---|---|
date | Tue, 08 Nov 2016 17:35:03 +0900 |
parents | a747dc9d4da6 |
children | 04a2f486a30d |
files | src/parallel_execution/CMakeLists.txt src/parallel_execution/rb_tree.c |
diffstat | 2 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/CMakeLists.txt Tue Nov 08 15:01:08 2016 +0900 +++ b/src/parallel_execution/CMakeLists.txt Tue Nov 08 17:35:03 2016 +0900 @@ -1,7 +1,8 @@ cmake_minimum_required(VERSION 2.8) # -DUSE_CUDA -add_definitions("-Wall -g -O") +# add_definitions("-Wall -g -O") +add_definitions("-Wall -g") set(CMAKE_C_COMPILER $ENV{CBC_COMPILER})
--- a/src/parallel_execution/rb_tree.c Tue Nov 08 15:01:08 2016 +0900 +++ b/src/parallel_execution/rb_tree.c Tue Nov 08 17:35:03 2016 +0900 @@ -113,8 +113,8 @@ context->data[Traverse]->traverse.newNode); } -__code insertCase1(struct Context* context, struct Tree* tree, struct Stack* nodeStack) { - if (nodeStack != NULL) { +__code insertCase1(struct Context* context, struct Tree* tree, struct SingleLinkedStack* nodeStack) { + if (nodeStack->top != NULL) { goto meta(context, InsertCase2); } tree->root->color = Black; @@ -124,7 +124,7 @@ __code insert1_stub(struct Context* context) { goto insertCase1(context, &context->data[Tree]->tree, - context->data[Traverse]->traverse.nodeStack); + &context->data[Traverse]->traverse.nodeStack->stack->singleLinkedStack); } __code insertCase2(struct Context* context, struct Stack* nodeStack, struct Node* parent) { @@ -136,7 +136,8 @@ } __code insert2_stub(struct Context* context) { - goto insertCase2(context, context->data[Traverse]->traverse.nodeStack, (struct Node*)context->data[Traverse]->traverse.nodeStack->data); + struct SingleLinkedStack *nodeStack = (struct SingleLinkedStack*)context->data[Traverse]->traverse.nodeStack->stack; + goto insertCase2(context, context->data[Traverse]->traverse.nodeStack, &nodeStack->top->data->node); } __code insertCase3(struct Context* context, struct Traverse* traverse, struct Node* parent, struct Node* grandparent) { @@ -304,7 +305,8 @@ __code stackClear(struct Context* context, struct Traverse* traverse) { traverse->current = 0; - traverse->nodeStack = NULL; + struct SingleLinkedStack* nodeStack = &context->data[Traverse]->traverse.nodeStack->stack->singleLinkedStack; + nodeStack->top = NULL; goto meta(context, context->next); }