diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-03-18 17:33:05 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-03-18 17:48:57 +0200 |
commit | 4dfaaaa42d29900ccedaec5bcac08d8d46778b79 (patch) | |
tree | f63b75a9d920586093b872506d13fbfb0d9c67c7 | |
parent | 81da222eae5036808ef52fa5d534838f19623901 (diff) | |
download | rpm-4dfaaaa42d29900ccedaec5bcac08d8d46778b79.tar.gz rpm-4dfaaaa42d29900ccedaec5bcac08d8d46778b79.tar.bz2 rpm-4dfaaaa42d29900ccedaec5bcac08d8d46778b79.zip |
Minor cleanups to rpmtsAddInstallElement()
- combine some checks where it makes sense
- initialize isSource at declaration
- remove unnecessary NULL check on obsoletes, rpmdsNext() handles it
-rw-r--r-- | lib/depends.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/depends.c b/lib/depends.c index 323285e6e..87d4deb2b 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -111,7 +111,7 @@ int rpmtsAddInstallElement(rpmts ts, Header h, rpm_color_t ohcolor; rpmdbMatchIterator mi; Header oh; - int isSource; + int isSource = headerIsSource(h); int duplicate = 0; rpmtsi pi = NULL; rpmte p; rpmds oldChk = NULL, newChk = NULL, sameChk = NULL; @@ -132,7 +132,6 @@ int rpmtsAddInstallElement(rpmts ts, Header h, } /* XXX Always add source headers. */ - isSource = headerIsSource(h); if (isSource) { oc = tsmem->orderCount; goto addheader; @@ -165,9 +164,7 @@ int rpmtsAddInstallElement(rpmts ts, Header h, const char * parch = rpmteA(p); const char * pos = rpmteO(p); - if (arch == NULL || parch == NULL) - continue; - if (os == NULL || pos == NULL) + if (arch == NULL || parch == NULL || os == NULL || pos == NULL) continue; if (!rstreq(arch, parch) || !rstreq(os, pos)) continue; @@ -254,12 +251,8 @@ addheader: if (upgrade & 0x2) (void) rpmteSetHeader(p, h); - /* If not upgrading, then we're done. */ - if (!(upgrade & 0x1)) - goto exit; - - /* XXX binary rpms always have RPMTAG_SOURCERPM, source rpms do not */ - if (isSource) + /* If not upgrading or a source package, then we're done. */ + if (!(upgrade & 0x1) || isSource) goto exit; /* Do lazy (readonly?) open of rpm database. */ @@ -288,7 +281,6 @@ addheader: obsoletes = rpmdsLink(rpmteDS(p, RPMTAG_OBSOLETENAME), RPMDBG_M("Obsoletes")); obsoletes = rpmdsInit(obsoletes); - if (obsoletes != NULL) while (rpmdsNext(obsoletes) >= 0) { const char * Name; |