baum
diff actions.c @ 55:6279e5b14d9e
added error handling for fopen and malloc; code cleanups
author | meillo@marmaro.de |
---|---|
date | Sun, 16 Mar 2008 10:40:53 +0100 |
parents | 036779d5da75 |
children | 21ff1783f640 |
line diff
1.1 --- a/actions.c Sun Mar 02 16:43:07 2008 +0100 1.2 +++ b/actions.c Sun Mar 16 10:40:53 2008 +0100 1.3 @@ -66,10 +66,8 @@ 1.4 struct Node* tp; 1.5 1.6 node->value = 0; 1.7 - tp = node->down; 1.8 - while (tp != NULL) { 1.9 + for (tp = node->down; tp != NULL; tp = tp->right) { 1.10 node->value += action(tp); 1.11 - tp = tp->right; 1.12 } 1.13 return node->value; 1.14 } 1.15 @@ -102,6 +100,7 @@ 1.16 1.17 unsigned char action_times(struct Node* node) { 1.18 unsigned char i; 1.19 + 1.20 for (i = 0; i < node->value; i++) { 1.21 insertLast(node, copyTree(node->down)); 1.22 }