Kill rpmfiUpdateState and free all the rpmfis as soon as file conflict check is done
authorFlorian Festi <ffesti@redhat.com>
Wed, 3 Dec 2008 09:59:05 +0000 (10:59 +0100)
committerFlorian Festi <ffesti@redhat.com>
Wed, 10 Dec 2008 12:40:53 +0000 (13:40 +0100)
lib/rpmfi.c
lib/rpmfi_internal.h
lib/transaction.c

index 797e44d..4efd16a 100644 (file)
@@ -1421,20 +1421,6 @@ fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, Type, (fi ? fi->fc : 0));
     return rpmfiLink(fi, (fi ? fi->Type : NULL));
 }
 
-rpmfi rpmfiUpdateState(rpmfi fi, rpmts ts, rpmte p)
-{
-    rpmte savep;
-
-    fi = rpmfiFree(fi);
-
-    savep = rpmtsSetRelocateElement(ts, p);
-    fi = rpmfiNew(ts, p->h, RPMTAG_BASENAMES, RPMFI_KEEPHEADER);
-    (void) rpmtsSetRelocateElement(ts, savep);
-
-    p->fi = fi;
-    return fi;
-}
-
 void rpmfiSetFReplacedSize(rpmfi fi, rpm_loff_t newsize)
 {
     if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
index 1a73fb7..62253e4 100644 (file)
@@ -95,9 +95,6 @@ int nrefs;            /*!< Reference count. */
 };
 
 RPM_GNUC_INTERNAL
-rpmfi rpmfiUpdateState(rpmfi fi, rpmts ts, rpmte p);
-
-RPM_GNUC_INTERNAL
 void rpmfiSetFReplacedSize(rpmfi fi, rpm_loff_t newsize);
 
 RPM_GNUC_INTERNAL
index cfdf589..5081bc0 100644 (file)
@@ -869,15 +869,18 @@ static int rpmtsProcess(rpmts ts)
            pkgStage stage = PSM_UNKNOWN;
            int async = (rpmtsiOc(pi) >= rpmtsUnorderedSuccessors(ts, -1)) ? 
                        1 : 0;
+           rpmte savep;
+
+           savep = rpmtsSetRelocateElement(ts, p);
+           fi = p->fi = rpmfiNew(ts, p->h, RPMTAG_BASENAMES, RPMFI_KEEPHEADER);
+           (void) rpmtsSetRelocateElement(ts, savep);
 
            switch (tetype) {
            case TR_ADDED:
                stage = PSM_PKGINSTALL;
-               fi = rpmfiUpdateState(rpmteFI(p), ts, p);
                break;
            case TR_REMOVED:
                stage = PSM_PKGERASE;
-               fi = rpmteFI(p);
                break;
            }
            psm = rpmpsmNew(ts, p, fi);
@@ -888,6 +891,7 @@ static int rpmtsProcess(rpmts ts)
            (void) rpmswExit(rpmtsOp(ts, op), 0);
            psm = rpmpsmFree(psm);
            rpmteClose(p, ts);
+           p->fi = rpmfiFree(p->fi);
        }
        if (failed) {
            rpmteMarkFailed(p, ts);
@@ -1233,6 +1237,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
        if (rpmfiFC(fi) == 0)
            continue;
        fi->fps = _free(fi->fps);
+       p->fi = rpmfiFree(fi);
     }
     pi = rpmtsiFree(pi);