From dc2a09c8ac265186ee78e025f45a523c53e3218d Mon Sep 17 00:00:00 2001 From: ticktock35 Date: Mon, 15 Dec 2008 00:33:16 -0500 Subject: opkg: introduce active list into pkg_t git-svn-id: http://opkg.googlecode.com/svn/trunk@173 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- 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 */ -- cgit v0.9.1