opkg: introduce active list into pkg_t
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 05:33:16 +0000 (05:33 +0000)
committerticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 05:33:16 +0000 (05:33 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@173 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/active_list.c
libopkg/pkg.c
libopkg/pkg.h

index 2694689..08e1bd7 100644 (file)
@@ -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) {
index 7ec3498..26bf484 100644 (file)
@@ -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;
 
index e7239f1..a7c98ec 100644 (file)
@@ -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 */