summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libopkg/active_list.c4
-rw-r--r--libopkg/pkg.c6
-rw-r--r--libopkg/pkg.h2
3 files changed, 10 insertions, 2 deletions
diff --git a/libopkg/active_list.c b/libopkg/active_list.c
index 2694689..08e1bd7 100644
--- a/libopkg/active_list.c
+++ b/libopkg/active_list.c
@@ -86,6 +86,10 @@ static void list_head_clear (struct list_head *head) {
}
void active_list_clear(struct active_list *head) {
list_head_clear(&head->node);
+ if (head->depend.next != &head->depend) {
+ list_head_clear(&head->depend);
+ }
+ active_list_init(head);
}
void active_list_add_depend(struct active_list *node, struct active_list *depend) {
diff --git a/libopkg/pkg.c b/libopkg/pkg.c
index 7ec3498..26bf484 100644
--- a/libopkg/pkg.c
+++ b/libopkg/pkg.c
@@ -90,7 +90,6 @@ pkg_t *pkg_new(void)
int pkg_init(pkg_t *pkg)
{
- memset(pkg, 0, sizeof(pkg_t));
pkg->name = NULL;
pkg->epoch = 0;
pkg->version = NULL;
@@ -112,6 +111,8 @@ int pkg_init(pkg_t *pkg)
pkg->recommends_str = NULL;
pkg->suggests_count = 0;
pkg->recommends_count = 0;
+
+ active_list_init(&pkg->list);
/* Abhaya: added init for conflicts fields */
pkg->conflicts = NULL;
@@ -183,7 +184,8 @@ void pkg_deinit(pkg_t *pkg)
pkg->state_flag = SF_OK;
pkg->state_status = SS_NOT_INSTALLED;
- //for (i = 0; i < pkg->replaces_count; i++)
+ active_list_clear(&pkg->list);
+
free (pkg->replaces);
pkg->replaces = NULL;
diff --git a/libopkg/pkg.h b/libopkg/pkg.h
index e7239f1..a7c98ec 100644
--- a/libopkg/pkg.h
+++ b/libopkg/pkg.h
@@ -24,6 +24,7 @@
#include "pkg_vec.h"
#include "str_list.h"
+#include "active_list.h"
#include "pkg_src.h"
#include "pkg_dest.h"
#include "opkg_conf.h"
@@ -135,6 +136,7 @@ struct pkg
int recommends_count;
char **suggests_str;
int suggests_count;
+ struct active_list list; /* Used for installing|upgrading */
compound_depend_t * depends;
/* Abhaya: new conflicts */