From 7e5099e52fe90a054a6b1bdf45265e7185233a1e Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 21 Sep 2007 15:17:08 +0300 Subject: [PATCH] Rename alKey & alNum to rpmal* for namespacing Also move it out of rpmlib.h, nothing needs it there... --- lib/depends.c | 10 +++++----- lib/rpmal.c | 44 ++++++++++++++++++++++---------------------- lib/rpmal.h | 25 ++++++++++++++++++------- lib/rpmlib.h | 2 ++ lib/rpmte.c | 10 +++++----- lib/rpmte.h | 16 +++++++++------- lib/transaction.c | 6 +++--- python/rpmal-py.c | 6 +++--- 8 files changed, 67 insertions(+), 52 deletions(-) diff --git a/lib/depends.c b/lib/depends.c index a15df51..96c61c1 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -30,7 +30,7 @@ typedef struct orderListIndex_s * orderListIndex; /** */ struct orderListIndex_s { - alKey pkgKey; + rpmalKey pkgKey; int orIndex; }; @@ -65,7 +65,7 @@ static int intcmp(const void * a, const void * b) * @return 0 on success */ static int removePackage(rpmts ts, Header h, int dboffset, - alKey depends) + rpmalKey depends) { rpmte p; @@ -119,7 +119,7 @@ int rpmtsAddInstallElement(rpmts ts, Header h, const char * os; rpmds oldChk, newChk; rpmds obsoletes; - alKey pkgKey; /* addedPackages key */ + rpmalKey pkgKey; /* addedPackages key */ int xx; int ec = 0; int rc; @@ -919,7 +919,7 @@ static inline int addRelation(rpmts ts, tsortInfo tsi; const char * Name; fnpyKey key; - alKey pkgKey; + rpmalKey pkgKey; int i = 0; if ((Name = rpmdsN(requires)) == NULL) @@ -1054,7 +1054,7 @@ int rpmtsOrder(rpmts ts) rpmtsi ri; rpmte r; tsortInfo tsi; tsortInfo tsi_next; - alKey * ordering; + rpmalKey * ordering; int orderingCount = 0; unsigned char * selected = alloca(sizeof(*selected) * (ts->orderCount + 1)); int loopcheck; diff --git a/lib/rpmal.c b/lib/rpmal.c index 9f4b403..4ee9b49 100644 --- a/lib/rpmal.c +++ b/lib/rpmal.c @@ -36,7 +36,7 @@ typedef struct availableIndexEntry_s * availableIndexEntry; * A single available item (e.g. a Provides: dependency). */ struct availableIndexEntry_s { - alKey pkgKey; /*!< Containing package. */ + rpmalKey pkgKey; /*!< Containing package. */ const char * entry; /*!< Dependency name. */ unsigned short entryLen; /*!< No. of bytes in name. */ unsigned short entryIx; /*!< Dependency index. */ @@ -64,7 +64,7 @@ typedef struct fileIndexEntry_s * fileIndexEntry; struct fileIndexEntry_s { const char * baseName; /*!< File basename. */ int baseNameLen; - alNum pkgNum; /*!< Containing package index. */ + rpmalNum pkgNum; /*!< Containing package index. */ uint_32 ficolor; }; @@ -119,16 +119,16 @@ static int alGetSize(const rpmal al) } #endif -static inline alNum alKey2Num(const rpmal al, - alKey pkgKey) +static inline rpmalNum alKey2Num(const rpmal al, + rpmalKey pkgKey) { - return ((alNum)pkgKey); + return ((rpmalNum)pkgKey); } -static inline alKey alNum2Key(const rpmal al, - alNum pkgNum) +static inline rpmalKey alNum2Key(const rpmal al, + rpmalNum pkgNum) { - return ((alKey)pkgNum); + return ((rpmalKey)pkgNum); } #ifdef DYING @@ -139,9 +139,9 @@ static inline alKey alNum2Key(const rpmal al, * @return available package pointer */ static availablePackage alGetPkg(const rpmal al, - alKey pkgKey) + rpmalKey pkgKey) { - alNum pkgNum = alKey2Num(al, pkgKey); + rpmalNum pkgNum = alKey2Num(al, pkgKey); availablePackage alp = NULL; if (al != NULL && pkgNum >= 0 && pkgNum < alGetSize(al)) { @@ -254,9 +254,9 @@ fprintf(stderr, "\n"); return strcmp(a->baseName, b->baseName); } -void rpmalDel(rpmal al, alKey pkgKey) +void rpmalDel(rpmal al, rpmalKey pkgKey) { - alNum pkgNum = alKey2Num(al, pkgKey); + rpmalNum pkgNum = alKey2Num(al, pkgKey); availablePackage alp; rpmfi fi; @@ -353,10 +353,10 @@ fprintf(stderr, " die[%5d] memset(%p,0,0x%lx)\n", al->numDirs, al->dirs + al- return; } -alKey rpmalAdd(rpmal * alistp, alKey pkgKey, fnpyKey key, +rpmalKey rpmalAdd(rpmal * alistp, rpmalKey pkgKey, fnpyKey key, rpmds provides, rpmfi fi, uint_32 tscolor) { - alNum pkgNum; + rpmalNum pkgNum; rpmal al; availablePackage alp; @@ -520,8 +520,8 @@ fprintf(stderr, "\t%p[%3d] %p:%p[%2d] %s\n", die->files, die->numFiles, fie, fie rpmalFreeIndex(al); -assert(((alNum)(alp - al->list)) == pkgNum); - return ((alKey)(alp - al->list)); +assert(((rpmalNum)(alp - al->list)) == pkgNum); + return ((rpmalKey)(alp - al->list)); } /** @@ -543,11 +543,11 @@ static int indexcmp(const void * one, const void * two) return strcmp(a->entry, b->entry); } -void rpmalAddProvides(rpmal al, alKey pkgKey, rpmds provides, uint_32 tscolor) +void rpmalAddProvides(rpmal al, rpmalKey pkgKey, rpmds provides, uint_32 tscolor) { uint_32 dscolor; const char * Name; - alNum pkgNum = alKey2Num(al, pkgKey); + rpmalNum pkgNum = alKey2Num(al, pkgKey); availableIndex ai = &al->index; availableIndexEntry aie; int ix; @@ -605,7 +605,7 @@ void rpmalMakeIndex(rpmal al) ai->k = 0; for (i = 0; i < al->size; i++) { alp = al->list + i; - rpmalAddProvides(al, (alKey)i, alp->provides, alp->tscolor); + rpmalAddProvides(al, (rpmalKey)i, alp->provides, alp->tscolor); } /* Reset size to the no. of provides added. */ @@ -614,7 +614,7 @@ void rpmalMakeIndex(rpmal al) } fnpyKey * -rpmalAllFileSatisfiesDepend(const rpmal al, const rpmds ds, alKey * keyp) +rpmalAllFileSatisfiesDepend(const rpmal al, const rpmds ds, rpmalKey * keyp) { uint_32 tscolor; uint_32 ficolor; @@ -708,7 +708,7 @@ exit: } fnpyKey * -rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds, alKey * keyp) +rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds, rpmalKey * keyp) { availableIndex ai; availableIndexEntry needle; @@ -789,7 +789,7 @@ rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds, alKey * keyp) } fnpyKey -rpmalSatisfiesDepend(const rpmal al, const rpmds ds, alKey * keyp) +rpmalSatisfiesDepend(const rpmal al, const rpmds ds, rpmalKey * keyp) { fnpyKey * tmp = rpmalAllSatisfiesDepend(al, ds, keyp); diff --git a/lib/rpmal.h b/lib/rpmal.h index 1393fb1..cbd6ebd 100644 --- a/lib/rpmal.h +++ b/lib/rpmal.h @@ -12,6 +12,17 @@ extern int _rpmal_debug; */ typedef struct rpmal_s * rpmal; +/** \ingroup rpmtrans + * * An added/available package retrieval key. + * */ +typedef void * rpmalKey; +#define RPMAL_NOMATCH ((rpmalKey)-1L) + +/** \ingroup rpmtrans + * * An added/available package retrieval index. + * */ +typedef intptr_t rpmalNum; + #ifdef __cplusplus extern "C" { #endif @@ -35,7 +46,7 @@ rpmal rpmalFree(rpmal al); * @param al available list * @param pkgKey package key */ -void rpmalDel(rpmal al, alKey pkgKey); +void rpmalDel(rpmal al, rpmalKey pkgKey); /** * Add package to available list. @@ -47,8 +58,8 @@ void rpmalDel(rpmal al, alKey pkgKey); * @param tscolor transaction color bits * @return available package index */ -alKey rpmalAdd(rpmal * alistp, - alKey pkgKey, +rpmalKey rpmalAdd(rpmal * alistp, + rpmalKey pkgKey, fnpyKey key, rpmds provides, rpmfi fi, uint_32 tscolor); @@ -61,7 +72,7 @@ alKey rpmalAdd(rpmal * alistp, * @param tscolor transaction color bits */ void rpmalAddProvides(rpmal al, - alKey pkgKey, + rpmalKey pkgKey, rpmds provides, uint_32 tscolor); /** @@ -78,7 +89,7 @@ void rpmalMakeIndex(rpmal al); * @return associated package key(s), NULL if none */ fnpyKey * rpmalAllFileSatisfiesDepend(const rpmal al, - const rpmds ds, alKey * keyp); + const rpmds ds, rpmalKey * keyp); /** * Check added package file lists for package(s) that have a provide. @@ -88,7 +99,7 @@ fnpyKey * rpmalAllFileSatisfiesDepend(const rpmal al, * @return associated package key(s), NULL if none */ fnpyKey * rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds, - alKey * keyp); + rpmalKey * keyp); /** * Check added package file lists for first package that has a provide. @@ -99,7 +110,7 @@ fnpyKey * rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds, * @return associated package key, NULL if none */ fnpyKey rpmalSatisfiesDepend(const rpmal al, const rpmds ds, - alKey * keyp); + rpmalKey * keyp); #ifdef __cplusplus } diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 02bc01d..6f45b54 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -53,6 +53,7 @@ typedef struct rpmts_s * rpmts; */ typedef struct Spec_s * Spec; +#if 0 /** \ingroup rpmtrans * An added/available package retrieval key. */ @@ -63,6 +64,7 @@ typedef void * alKey; * An added/available package retrieval index. */ typedef intptr_t alNum; +#endif /** \ingroup rpmtrans * Dependency tag sets from a header, so that a header can be discarded early. diff --git a/lib/rpmte.c b/lib/rpmte.c index 1129105..b7f8271 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -194,7 +194,7 @@ rpmte rpmteNew(const rpmts ts, Header h, fnpyKey key, rpmRelocation * relocs, int dboffset, - alKey pkgKey) + rpmalKey pkgKey) { rpmte p = xcalloc(1, sizeof(*p)); int_32 * ep; @@ -427,14 +427,14 @@ void rpmteNewTSI(rpmte te) } } -alKey rpmteAddedKey(rpmte te) +rpmalKey rpmteAddedKey(rpmte te) { return (te != NULL ? te->u.addedKey : RPMAL_NOMATCH); } -alKey rpmteSetAddedKey(rpmte te, alKey npkgKey) +rpmalKey rpmteSetAddedKey(rpmte te, rpmalKey npkgKey) { - alKey opkgKey = RPMAL_NOMATCH; + rpmalKey opkgKey = RPMAL_NOMATCH; if (te != NULL) { opkgKey = te->u.addedKey; te->u.addedKey = npkgKey; @@ -443,7 +443,7 @@ alKey rpmteSetAddedKey(rpmte te, alKey npkgKey) } -alKey rpmteDependsOnKey(rpmte te) +rpmalKey rpmteDependsOnKey(rpmte te) { return (te != NULL ? te->u.removed.dependsOnKey : RPMAL_NOMATCH); } diff --git a/lib/rpmte.h b/lib/rpmte.h index 7b37fbc..2edf04f 100644 --- a/lib/rpmte.h +++ b/lib/rpmte.h @@ -6,6 +6,8 @@ * Structures used for an "rpmte" transaction element. */ +#include "rpmal.h" + /** */ extern int _rpmte_debug; @@ -90,9 +92,9 @@ struct rpmte_s { FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */ union { - alKey addedKey; + rpmalKey addedKey; struct { - alKey dependsOnKey; + rpmalKey dependsOnKey; int dboffset; } removed; } u; @@ -137,7 +139,7 @@ rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type, fnpyKey key, rpmRelocation * relocs, int dboffset, - alKey pkgKey); + rpmalKey pkgKey); /** * Retrieve header from transaction element. @@ -368,7 +370,7 @@ void rpmteCleanDS(rpmte te); * @param te transaction element * @return pkgKey */ -alKey rpmteAddedKey(rpmte te); +rpmalKey rpmteAddedKey(rpmte te); /** * Set pkgKey of TR_ADDED transaction element. @@ -376,15 +378,15 @@ alKey rpmteAddedKey(rpmte te); * @param npkgKey new pkgKey * @return previous pkgKey */ -alKey rpmteSetAddedKey(rpmte te, - alKey npkgKey); +rpmalKey rpmteSetAddedKey(rpmte te, + rpmalKey npkgKey); /** * Retrieve dependent pkgKey of TR_REMOVED transaction element. * @param te transaction element * @return dependent pkgKey */ -alKey rpmteDependsOnKey(rpmte te); +rpmalKey rpmteDependsOnKey(rpmte te); /** * Retrieve rpmdb instance of TR_REMOVED transaction element. diff --git a/lib/transaction.c b/lib/transaction.c index 51a1399..66198c6 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -1313,7 +1313,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) sharedFileInfo shared, sharedList; int numShared; int nexti; - alKey lastFailKey; + rpmalKey lastFailKey; fingerPrintCache fpc; rpmps ps; rpmpsm psm; @@ -1920,11 +1920,11 @@ assert(psm != NULL); /* =============================================== * Install and remove packages. */ - lastFailKey = (alKey)-2; /* erased packages have -1 */ + lastFailKey = (rpmalKey)-2; /* erased packages have -1 */ pi = rpmtsiInit(ts); /* FIX: fi reload needs work */ while ((p = rpmtsiNext(pi, 0)) != NULL) { - alKey pkgKey; + rpmalKey pkgKey; int gotfd; gotfd = 0; diff --git a/python/rpmal-py.c b/python/rpmal-py.c index 0eafd84..f941aa2 100644 --- a/python/rpmal-py.c +++ b/python/rpmal-py.c @@ -30,7 +30,7 @@ rpmal_Add(rpmalObject * s, PyObject * args, PyObject * kwds) rpmdsObject * dso; rpmfiObject * fio; PyObject * key; - alKey pkgKey; + rpmalKey pkgKey; char * kwlist[] = {"packageKey", "key", "dso", "fileInfo", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "iOO!O!:Add", kwlist, @@ -47,7 +47,7 @@ rpmal_Add(rpmalObject * s, PyObject * args, PyObject * kwds) static PyObject * rpmal_Del(rpmalObject * s, PyObject * args, PyObject * kwds) { - alKey pkgKey; + rpmalKey pkgKey; char * kwlist[] = {"key", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "i:Del", kwlist, &pkgKey)) @@ -63,7 +63,7 @@ static PyObject * rpmal_AddProvides(rpmalObject * s, PyObject * args, PyObject * kwds) { rpmdsObject * dso; - alKey pkgKey; + rpmalKey pkgKey; char * kwlist[] = {"index", "packageIndex", "dso", NULL}; /* XXX: why is there an argument listed in the format string that -- 2.7.4