Mercurial > 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 wrap: on
line diff
--- a/actions.c Sun Mar 02 16:43:07 2008 +0100 +++ b/actions.c Sun Mar 16 10:40:53 2008 +0100 @@ -66,10 +66,8 @@ struct Node* tp; node->value = 0; - tp = node->down; - while (tp != NULL) { + for (tp = node->down; tp != NULL; tp = tp->right) { node->value += action(tp); - tp = tp->right; } return node->value; } @@ -102,6 +100,7 @@ unsigned char action_times(struct Node* node) { unsigned char i; + for (i = 0; i < node->value; i++) { insertLast(node, copyTree(node->down)); }