From 24780b810eb94ee7e444da670eee3557d02ca3d4 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 17 Dec 2009 16:47:12 +0200 Subject: [PATCH] Eliminate unused + unnecessary transaction element iterator mode --- lib/rpmte.c | 9 ++------- lib/rpmte_internal.h | 1 - lib/rpmts.h | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/rpmte.c b/lib/rpmte.c index edf1e54..2f212a5 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -703,8 +703,7 @@ rpmtsi rpmtsiInit(rpmts ts) tsi = xcalloc(1, sizeof(*tsi)); tsi->ts = rpmtsLink(ts, RPMDBG_M("rpmtsi")); - tsi->reverse = ((rpmtsFlags(ts) & RPMTRANS_FLAG_REVERSE) ? 1 : 0); - tsi->oc = (tsi->reverse ? (rpmtsNElements(ts) - 1) : 0); + tsi->oc = 0; tsi->ocsave = tsi->oc; return tsi; } @@ -723,11 +722,7 @@ rpmte rpmtsiNextElement(rpmtsi tsi) if (tsi == NULL || tsi->ts == NULL || rpmtsNElements(tsi->ts) <= 0) return te; - if (tsi->reverse) { - if (tsi->oc >= 0) oc = tsi->oc--; - } else { - if (tsi->oc < rpmtsNElements(tsi->ts)) oc = tsi->oc++; - } + if (tsi->oc < rpmtsNElements(tsi->ts)) oc = tsi->oc++; tsi->ocsave = oc; if (oc != -1) te = rpmtsElement(tsi->ts, oc); diff --git a/lib/rpmte_internal.h b/lib/rpmte_internal.h index d453016..3d97c57 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 reverse; /*!< reversed traversal? */ int ocsave; /*!< last returned iterator index. */ int oc; /*!< iterator index. */ }; diff --git a/lib/rpmts.h b/lib/rpmts.h index 1c7f12c..655e2f7 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -43,7 +43,7 @@ typedef enum rpmtransFlags_e { RPMTRANS_FLAG_PKGUNDO = (1 << 12), RPMTRANS_FLAG_COMMIT = (1 << 13), RPMTRANS_FLAG_UNDO = (1 << 14), - RPMTRANS_FLAG_REVERSE = (1 << 15), + RPMTRANS_FLAG_REVERSE = (1 << 15), /*!< obsolete, unused */ RPMTRANS_FLAG_NOTRIGGERPREIN= (1 << 16), /*!< from --notriggerprein */ RPMTRANS_FLAG_NOPRE = (1 << 17), /*!< from --nopre */ -- 2.7.4