From 80853dbe99a772cdceb57c4b5f39e270c0319795 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 17 Dec 2009 17:28:37 +0200 Subject: [PATCH] Eliminate unnecessary rpmtsiOc() - it used to be called from ordering code but now there's precisely one caller which used it as a fancy way to do increment an integer... rip --- lib/rpmte.c | 7 ------- lib/rpmte.h | 7 ------- lib/rpmte_internal.h | 1 - lib/transaction.c | 8 +++----- 4 files changed, 3 insertions(+), 20 deletions(-) diff --git a/lib/rpmte.c b/lib/rpmte.c index 2f212a5..266384c 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -684,11 +684,6 @@ assert (ix < Count); free(refs); } -int rpmtsiOc(rpmtsi tsi) -{ - return tsi->ocsave; -} - rpmtsi rpmtsiFree(rpmtsi tsi) { /* XXX watchout: a funky recursion segfaults here iff nrefs is wrong. */ @@ -704,7 +699,6 @@ rpmtsi rpmtsiInit(rpmts ts) tsi = xcalloc(1, sizeof(*tsi)); tsi->ts = rpmtsLink(ts, RPMDBG_M("rpmtsi")); tsi->oc = 0; - tsi->ocsave = tsi->oc; return tsi; } @@ -723,7 +717,6 @@ rpmte rpmtsiNextElement(rpmtsi tsi) return te; if (tsi->oc < rpmtsNElements(tsi->ts)) oc = tsi->oc++; - tsi->ocsave = oc; if (oc != -1) te = rpmtsElement(tsi->ts, oc); return te; diff --git a/lib/rpmte.h b/lib/rpmte.h index bc1ffcd..312bfa5 100644 --- a/lib/rpmte.h +++ b/lib/rpmte.h @@ -359,13 +359,6 @@ rpmfi rpmteFI(rpmte te); void rpmteColorDS(rpmte te, rpmTag tag); /** \ingroup rpmte - * Return transaction element index. - * @param tsi transaction element iterator - * @return transaction element index - */ -int rpmtsiOc(rpmtsi tsi); - -/** \ingroup rpmte * Destroy transaction element iterator. * @param tsi transaction element iterator * @return NULL always diff --git a/lib/rpmte_internal.h b/lib/rpmte_internal.h index 3d97c57..a513932 100644 --- a/lib/rpmte_internal.h +++ b/lib/rpmte_internal.h @@ -63,7 +63,6 @@ struct rpmfs_s { */ struct rpmtsi_s { rpmts ts; /*!< transaction set. */ - int ocsave; /*!< last returned iterator index. */ int oc; /*!< iterator index. */ }; diff --git a/lib/transaction.c b/lib/transaction.c index e4f282b..1860dfb 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -847,6 +847,7 @@ rpmdbMatchIterator rpmFindBaseNamesInDB(rpmts ts, uint64_t fileCount) rpmfi fi; rpmdbMatchIterator mi; int xx; + int oc = 0; const char * baseName; rpmStringSet baseNames = rpmStringSetCreate(fileCount, @@ -858,13 +859,10 @@ rpmdbMatchIterator rpmFindBaseNamesInDB(rpmts ts, uint64_t fileCount) while ((p = rpmtsiNext(pi, 0)) != NULL) { (void) rpmdbCheckSignals(); - if ((fi = rpmteFI(p)) == NULL) - continue; /* XXX can't happen */ - rpmtsNotify(ts, NULL, RPMCALLBACK_TRANS_PROGRESS, rpmtsiOc(pi), - ts->orderCount); + rpmtsNotify(ts, NULL, RPMCALLBACK_TRANS_PROGRESS, oc++, ts->orderCount); /* Gather all installed headers with matching basename's. */ - fi = rpmfiInit(fi, 0); + fi = rpmfiInit(rpmteFI(p), 0); while (rpmfiNext(fi) >= 0) { size_t keylen; baseName = rpmfiBN(fi); -- 2.7.4