unpack: fix the dangling pointer and overloaded variable name
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
d8023d00db
commit
cdb37d9bd0
1 changed files with 18 additions and 18 deletions
36
unpack.c
36
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
|
||||
|
|
Loading…
Reference in a new issue