]> err.no Git - dpkg/commitdiff
* clean up the conflicts/replaces, use an array of pkginfo pointers instead
authorBen Collins <bcollins@debian.org>
Wed, 9 Feb 2000 02:58:17 +0000 (02:58 +0000)
committerBen Collins <bcollins@debian.org>
Wed, 9 Feb 2000 02:58:17 +0000 (02:58 +0000)
  of the obsolete conflict struct. saves memory, faster...what more could
  you want.

include/dpkg-db.h
main/archives.c
main/archives.h
main/processarc.c

index 4fab1f7b38ec89544a3a9eaed40bded8f4ca258a..1820a4132c6646ee30b04ef610945884050c74e0 100644 (file)
@@ -72,11 +72,6 @@ struct deppossi {
   int cyclebreak;
 };
 
-struct conflict {
-  struct pkginfo *cflict;
-  struct conflict *next;
-};
-
 struct arbitraryfield {
   struct arbitraryfield *next;
   char *name;
index bbcae79ee5beefca9e8cb710debf64c9f06dcce1..6cc61eb990e9a104b1ab90de88e0bcd5d56f66fd 100644 (file)
@@ -43,7 +43,7 @@
 #include "archives.h"
 
 /* We shouldn't need anymore than 10 conflictors */
-struct conflict conflictor[10];
+struct pkginfo *conflictor[20];
 int cflict_index = 0;
 
 int filesavespackage(struct fileinlist *file, struct pkginfo *pkgtobesaved,
@@ -658,9 +658,9 @@ void check_conflict(struct dependency *dep, struct pkginfo *pkg,
        /* if this gets triggered, it means a package has > 10 conflicts/replaces
         * pairs, which is the package's fault
         */
-       assert(cflict_index < 10);
+       assert(cflict_index < sizeof(conflictor));
         /* This conflict is OK - we'll remove the conflictor. */
-       conflictor[cflict_index++].cflict= fixbyrm;
+       conflictor[cflict_index++]= fixbyrm;
         varbuffree(&conflictwhy); varbuffree(&removalwhy);
         fprintf(stderr, _("dpkg: yes, will remove %s in favour of %s.\n"),
                 fixbyrm->name, pkg->name);
index 39a1f2fcf3685db0fee46bfe477855624a862002..a8464264fbbbe6a8f10c18576e407bbb895f0ef1 100644 (file)
@@ -34,7 +34,7 @@ extern struct varbuf fnametmpvb;
 extern struct varbuf fnamenewvb;
 extern struct packageinlist *deconfigure;
 
-extern struct conflict conflictor[];
+extern struct pkginfo *conflictor[];
 extern int cflict_index;
 
 void cu_pathname(int argc, void **argv);
index a32261abeac82120ace298a08039ab0ecf2b62cd..e073df7b0a8a333338e9f73ca88fd8004c0f7df1 100644 (file)
@@ -345,7 +345,7 @@ void process_archive(const char *filename) {
    */
   oldconffsetflags(pkg->installed.conffiles);
   for (i = 0 ; i < cflict_index ; i++) {
-    oldconffsetflags(conflictor[i].cflict->installed.conffiles);
+    oldconffsetflags(conflictor[i]->installed.conffiles);
   }
   
   oldversionstatus= pkg->status;
@@ -367,11 +367,11 @@ void process_archive(const char *filename) {
   }
 
   for (i = 0 ; i < cflict_index ; i++) {
-    if (!(conflictor[i].cflict->status == stat_halfconfigured ||
-         conflictor[i].cflict->status == stat_installed)) continue;
+    if (!(conflictor[i]->status == stat_halfconfigured ||
+         conflictor[i]->status == stat_installed)) continue;
     for (deconpil= deconfigure; deconpil; deconpil= deconpil->next) {
       printf(_("De-configuring %s, so that we can remove %s ...\n"),
-             deconpil->pkg->name, conflictor[i].cflict->name);
+             deconpil->pkg->name, conflictor[i]->name);
       deconpil->pkg->status= stat_halfconfigured;
       modstatdb_note(deconpil->pkg);
       /* This means that we *either* go and run postinst abort-deconfigure,
@@ -381,27 +381,27 @@ void process_archive(const char *filename) {
       push_cleanup(cu_prermdeconfigure,~ehflag_normaltidy,
                    ok_prermdeconfigure,ehflag_normaltidy,
                    3,(void*)deconpil->pkg,
-                  (void*)conflictor[i].cflict,(void*)pkg);
+                  (void*)conflictor[i],(void*)pkg);
       maintainer_script_installed(deconpil->pkg, PRERMFILE, "pre-removal",
                                   "deconfigure", "in-favour", pkg->name,
                                   versiondescribe(&pkg->available.version,
                                                   vdew_nonambig),
-                                  "removing", conflictor[i].cflict->name,
-                                  versiondescribe(&conflictor[i].cflict->installed.version,
+                                  "removing", conflictor[i]->name,
+                                  versiondescribe(&conflictor[i]->installed.version,
                                                   vdew_nonambig),
                                   (char*)0);
     }
-    conflictor[i].cflict->status= stat_halfconfigured;
-    modstatdb_note(conflictor[i].cflict);
+    conflictor[i]->status= stat_halfconfigured;
+    modstatdb_note(conflictor[i]);
     push_cleanup(cu_prerminfavour,~ehflag_normaltidy, 0,0,
-                 2,(void*)conflictor[i].cflict,(void*)pkg);
-    maintainer_script_installed(conflictor[i].cflict, PRERMFILE, "pre-removal",
+                 2,(void*)conflictor[i],(void*)pkg);
+    maintainer_script_installed(conflictor[i], PRERMFILE, "pre-removal",
                                 "remove", "in-favour", pkg->name,
                                 versiondescribe(&pkg->available.version,
                                                 vdew_nonambig),
                                 (char*)0);
-    conflictor[i].cflict->status= stat_halfinstalled;
-    modstatdb_note(conflictor[i].cflict);
+    conflictor[i]->status= stat_halfinstalled;
+    modstatdb_note(conflictor[i]);
   }
 
   pkg->eflag |= eflagf_reinstreq;
@@ -1011,7 +1011,7 @@ void process_archive(const char *filename) {
   for (i = 0 ; i < cflict_index ; i++) {
     /* We need to have the most up-to-date info about which files are what ... */
     ensure_allinstfiles_available();
-    removal_bulk(conflictor[i].cflict);
+    removal_bulk(conflictor[i]);
   }
 
   if (cipaction->arg == act_install) add_to_queue(pkg);