diff --git a/unpack.c b/unpack.c index a0f79b0..36313c9 100644 --- a/unpack.c +++ b/unpack.c @@ -266,19 +266,19 @@ dump_content_set (struct node *content_sets, struct stack *head, struct stack *tail) { int i; - struct stack stack; - stack.prev = tail; - tail->next = &stack; + static struct stack stk; + stk.prev = tail; + tail->next = &stk; for (i = 0; i < content_sets->count; i++) { - stack.path = content_sets->paths[i]; - dump_content_set(content_sets->children[i], head, &stack); + stk.path = content_sets->paths[i]; + dump_content_set(content_sets->children[i], head, &stk); } if (content_sets->count == 0) { struct stack *cur = head; - for (cur = head->next; cur != &stack; cur = cur->next) { + for (cur = head->next; cur != &stk; cur = cur->next) { printf("/%s", cur->path); } printf("\n"); @@ -288,11 +288,11 @@ dump_content_set (struct node *content_sets, struct stack *head, static void dump_content_sets (struct node *content_sets) { - struct stack stack; - stack.next = NULL; - stack.path = NULL; + static struct stack stk; + stk.next = NULL; + stk.path = NULL; - dump_content_set (content_sets, &stack, &stack); + dump_content_set (content_sets, &stk, &stk); } static void @@ -300,12 +300,12 @@ count_content_set (struct node *content_sets, struct stack *head, struct stack *tail, int *count) { int i; - struct stack stack; - tail->next = &stack; + static struct stack stk; + tail->next = &stk; for (i = 0; i < content_sets->count; i++) { - stack.path = content_sets->paths[i]; - count_content_set(content_sets->children[i], head, &stack, + stk.path = content_sets->paths[i]; + count_content_set(content_sets->children[i], head, &stk, count); } @@ -317,11 +317,11 @@ count_content_set (struct node *content_sets, struct stack *head, static void count_content_sets (struct node *content_sets, int *count) { - struct stack stack; - stack.next = NULL; - stack.path = NULL; + static struct stack stk; + stk.next = NULL; + stk.path = NULL; - count_content_set (content_sets, &stack, &stack, count); + count_content_set (content_sets, &stk, &stk, count); } static void