comparison actions.c @ 15:e2048e569891

insertLast returns now new inserted node; very dumb implementation for action_times
author meillo@marmaro.de
date Wed, 13 Feb 2008 09:57:07 +0100
parents 15e11eea1c66
children b62288419c1c
comparison
equal deleted inserted replaced
14:15e11eea1c66 15:e2048e569891
83 } 83 }
84 84
85 85
86 unsigned char action_times(struct Node* node) { 86 unsigned char action_times(struct Node* node) {
87 struct Node* tp; 87 struct Node* tp;
88 struct Node* last;
88 unsigned char i; 89 unsigned char i;
89 tp = node->down; 90 tp = node->down;
90 for (i = 0; i < node->value; i++) { 91 for (i = 0; i < node->value; i++) {
91 /* deep copy */ 92 /* deep copy */
93 last = insertLast(node, newNode(tp->name, tp->value));
94 if (tp->down != NULL) {
95 last->down = newNode(tp->down->name, tp->down->value);
96 }
97
92 } 98 }
93 return 0; 99 return 0;
94 } 100 }
95 101
96 102