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)
|
struct stack *tail)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct stack stack;
|
static struct stack stk;
|
||||||
stack.prev = tail;
|
stk.prev = tail;
|
||||||
tail->next = &stack;
|
tail->next = &stk;
|
||||||
|
|
||||||
for (i = 0; i < content_sets->count; i++) {
|
for (i = 0; i < content_sets->count; i++) {
|
||||||
stack.path = content_sets->paths[i];
|
stk.path = content_sets->paths[i];
|
||||||
dump_content_set(content_sets->children[i], head, &stack);
|
dump_content_set(content_sets->children[i], head, &stk);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content_sets->count == 0) {
|
if (content_sets->count == 0) {
|
||||||
struct stack *cur = head;
|
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("/%s", cur->path);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -288,11 +288,11 @@ dump_content_set (struct node *content_sets, struct stack *head,
|
||||||
static void
|
static void
|
||||||
dump_content_sets (struct node *content_sets)
|
dump_content_sets (struct node *content_sets)
|
||||||
{
|
{
|
||||||
struct stack stack;
|
static struct stack stk;
|
||||||
stack.next = NULL;
|
stk.next = NULL;
|
||||||
stack.path = NULL;
|
stk.path = NULL;
|
||||||
|
|
||||||
dump_content_set (content_sets, &stack, &stack);
|
dump_content_set (content_sets, &stk, &stk);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -300,12 +300,12 @@ count_content_set (struct node *content_sets, struct stack *head,
|
||||||
struct stack *tail, int *count)
|
struct stack *tail, int *count)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct stack stack;
|
static struct stack stk;
|
||||||
tail->next = &stack;
|
tail->next = &stk;
|
||||||
|
|
||||||
for (i = 0; i < content_sets->count; i++) {
|
for (i = 0; i < content_sets->count; i++) {
|
||||||
stack.path = content_sets->paths[i];
|
stk.path = content_sets->paths[i];
|
||||||
count_content_set(content_sets->children[i], head, &stack,
|
count_content_set(content_sets->children[i], head, &stk,
|
||||||
count);
|
count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,11 +317,11 @@ count_content_set (struct node *content_sets, struct stack *head,
|
||||||
static void
|
static void
|
||||||
count_content_sets (struct node *content_sets, int *count)
|
count_content_sets (struct node *content_sets, int *count)
|
||||||
{
|
{
|
||||||
struct stack stack;
|
static struct stack stk;
|
||||||
stack.next = NULL;
|
stk.next = NULL;
|
||||||
stack.path = NULL;
|
stk.path = NULL;
|
||||||
|
|
||||||
count_content_set (content_sets, &stack, &stack, count);
|
count_content_set (content_sets, &stk, &stk, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue