baum
changeset 10:0e15841ae111
s/list/stack/g because thats what it is
author | meillo@marmaro.de |
---|---|
date | Sat, 09 Feb 2008 16:49:29 +0100 |
parents | c020b0d1cfca |
children | 8a8da74530dd |
files | actions.c baum.c baum.h |
diffstat | 3 files changed, 16 insertions(+), 15 deletions(-) [+] |
line diff
1.1 --- a/actions.c Sat Feb 09 16:41:41 2008 +0100 1.2 +++ b/actions.c Sat Feb 09 16:49:29 2008 +0100 1.3 @@ -74,7 +74,8 @@ 1.4 unsigned char action_input(struct Node* node) { 1.5 /* 1.6 unsigned char input = (unsigned char) getchar(); 1.7 - getchar(); /* catches the newline */ 1.8 + getchar(); 1.9 + */ 1.10 1.11 /* reads a number which is treated as ASCII value */ 1.12 int input; 1.13 @@ -90,7 +91,7 @@ 1.14 struct Node* tp; 1.15 unsigned char i; 1.16 tp = node->down; 1.17 - for (i; i < node->value; i++) { 1.18 + for (i = 0; i < node->value; i++) { 1.19 /* deep copy */ 1.20 } 1.21 return 0;
2.1 --- a/baum.c Sat Feb 09 16:41:41 2008 +0100 2.2 +++ b/baum.c Sat Feb 09 16:49:29 2008 +0100 2.3 @@ -16,7 +16,7 @@ 2.4 2.5 2.6 struct Node* root = 0; 2.7 -struct Listitem* list = NULL; 2.8 +struct Stackitem* stack = NULL; 2.9 2.10 2.11 void logit(char* text) { 2.12 @@ -108,22 +108,22 @@ 2.13 2.14 2.15 void push(struct Node* node) { 2.16 - struct Listitem* tmp; 2.17 - struct Listitem* new; 2.18 - new = (struct Listitem*) malloc(sizeof(struct Listitem)); 2.19 + struct Stackitem* tmp; 2.20 + struct Stackitem* new; 2.21 + new = (struct Stackitem*) malloc(sizeof(struct Stackitem)); 2.22 new->node = node; 2.23 - tmp = list; 2.24 - list = new; 2.25 - list->next = tmp; 2.26 + tmp = stack; 2.27 + stack = new; 2.28 + stack->next = tmp; 2.29 } 2.30 struct Node* pull() { 2.31 - if (list == NULL) { 2.32 + if (stack == NULL) { 2.33 return NULL; 2.34 } 2.35 - struct Listitem* tmp; 2.36 + struct Stackitem* tmp; 2.37 struct Node* node; 2.38 - tmp = list; 2.39 - list = list->next; 2.40 + tmp = stack; 2.41 + stack = stack->next; 2.42 node = tmp->node; 2.43 free(tmp); tmp=0; 2.44 return node;