From 73c079735a2af231ff63e7150fdee3b33bacbae6 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 22 Oct 2010 11:27:01 +0300 Subject: [PATCH] Switch rpmds API and internals to use rpmTagVal instead of rpmTag - None of these require passing "true enum", the value is what counts. In general, enums as function argument types are just a royal PITA from C++, avoid when not strictly necessary. --- lib/rpmds.c | 26 +++++++++++++------------- lib/rpmds.h | 8 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/rpmds.c b/lib/rpmds.c index adc52ec..e1a3df7 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -25,7 +25,7 @@ struct rpmds_s { const char ** EVR; /*!< Epoch-Version-Release. */ rpmsenseFlags * Flags; /*!< Bit(s) identifying context/comparison. */ rpm_color_t * Color; /*!< Bit(s) calculated from file color(s). */ - rpmTag tagN; /*!< Header tag. */ + rpmTagVal tagN; /*!< Header tag. */ int32_t Count; /*!< No. of elements */ unsigned int instance; /*!< From rpmdb instance? */ int i; /*!< Element index. */ @@ -37,13 +37,13 @@ struct rpmds_s { static const char ** rpmdsDupArgv(const char ** argv, int argc); -static int dsType(rpmTag tag, - const char ** Type, rpmTag * tagEVR, rpmTag * tagF) +static int dsType(rpmTagVal tag, + const char ** Type, rpmTagVal * tagEVR, rpmTagVal * tagF) { int rc = 0; const char *t = NULL; - rpmTag evr = RPMTAG_NOT_FOUND; - rpmTag f = RPMTAG_NOT_FOUND; + rpmTagVal evr = RPMTAG_NOT_FOUND; + rpmTagVal f = RPMTAG_NOT_FOUND; if (tag == RPMTAG_PROVIDENAME) { t = "Provides"; @@ -90,7 +90,7 @@ rpmds rpmdsLink(rpmds ds) rpmds rpmdsFree(rpmds ds) { - rpmTag tagEVR, tagF; + rpmTagVal tagEVR, tagF; if (ds == NULL) return NULL; @@ -116,9 +116,9 @@ rpmds rpmdsFree(rpmds ds) return NULL; } -rpmds rpmdsNew(Header h, rpmTag tagN, int flags) +rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags) { - rpmTag tagEVR, tagF; + rpmTagVal tagEVR, tagF; rpmds ds = NULL; const char * Type; struct rpmtd_s names; @@ -204,7 +204,7 @@ char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds) return tbuf; } -static rpmds singleDS(rpmTag tagN, const char * N, const char * EVR, +static rpmds singleDS(rpmTagVal tagN, const char * N, const char * EVR, rpmsenseFlags Flags, unsigned int instance) { rpmds ds = NULL; @@ -231,7 +231,7 @@ exit: return rpmdsLink(ds); } -rpmds rpmdsThis(Header h, rpmTag tagN, rpmsenseFlags Flags) +rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags) { char *evr = headerGetAsString(h, RPMTAG_EVR); rpmds ds = singleDS(tagN, headerGetString(h, RPMTAG_NAME), @@ -240,7 +240,7 @@ rpmds rpmdsThis(Header h, rpmTag tagN, rpmsenseFlags Flags) return ds; } -rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, rpmsenseFlags Flags) +rpmds rpmdsSingle(rpmTagVal tagN, const char * N, const char * EVR, rpmsenseFlags Flags) { return singleDS(tagN, N, EVR, Flags, 0); } @@ -324,9 +324,9 @@ rpmsenseFlags rpmdsFlags(const rpmds ds) return Flags; } -rpmTag rpmdsTagN(const rpmds ds) +rpmTagVal rpmdsTagN(const rpmds ds) { - rpmTag tagN = RPMTAG_NOT_FOUND; + rpmTagVal tagN = RPMTAG_NOT_FOUND; if (ds != NULL) tagN = ds->tagN; diff --git a/lib/rpmds.h b/lib/rpmds.h index 7d5a951..5a91ba1 100644 --- a/lib/rpmds.h +++ b/lib/rpmds.h @@ -102,7 +102,7 @@ rpmds rpmdsFree(rpmds ds); * @param flags unused * @return new dependency set */ -rpmds rpmdsNew(Header h, rpmTag tagN, int flags); +rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags); /** \ingroup rpmds * Return new formatted dependency string. @@ -119,7 +119,7 @@ char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds); * @param Flags comparison flags * @return new dependency set */ -rpmds rpmdsThis(Header h, rpmTag tagN, rpmsenseFlags Flags); +rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags); /** \ingroup rpmds * Create, load and initialize a dependency set of size 1. @@ -129,7 +129,7 @@ rpmds rpmdsThis(Header h, rpmTag tagN, rpmsenseFlags Flags); * @param Flags comparison flags * @return new dependency set */ -rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, rpmsenseFlags Flags); +rpmds rpmdsSingle(rpmTagVal tagN, const char * N, const char * EVR, rpmsenseFlags Flags); /** \ingroup rpmds * Return a new dependency set of size 1 from the current iteration index @@ -193,7 +193,7 @@ rpmsenseFlags rpmdsFlags(const rpmds ds); * @param ds dependency set * @return current dependency type, 0 on invalid */ -rpmTag rpmdsTagN(const rpmds ds); +rpmTagVal rpmdsTagN(const rpmds ds); /** \ingroup rpmds * Return dependency header instance, ie whether the dependency comes from -- 2.7.4