From 630a5a4c1a34f12ae264cba870005de0858353e6 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 5 Feb 2008 12:12:31 +0200 Subject: [PATCH] Add rpm_color_t type for rpm color bits, use where spotted --- build/rpmfc.c | 8 ++++---- lib/depends.c | 18 +++++++++--------- lib/psm.c | 2 +- lib/rpmal.c | 16 ++++++++-------- lib/rpmal.h | 4 ++-- lib/rpmds.c | 10 +++++----- lib/rpmds.h | 2 +- lib/rpmfi.c | 12 ++++++------ lib/rpmfi.h | 4 ++-- lib/rpmfi_internal.h | 4 ++-- lib/rpmte.c | 10 +++++----- lib/rpmte.h | 4 ++-- lib/rpmte_internal.h | 2 +- lib/rpmts.c | 8 ++++---- lib/rpmts.h | 6 +++--- lib/rpmts_internal.h | 4 ++-- lib/rpmtypes.h | 2 ++ lib/transaction.c | 20 ++++++++++---------- python/rpmts-py.c | 2 +- rpmdb/hdrNVR.c | 6 +++--- 20 files changed, 73 insertions(+), 71 deletions(-) diff --git a/build/rpmfc.c b/build/rpmfc.c index d08fcd0..79ee500 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -56,7 +56,7 @@ struct rpmfc_s { */ struct rpmfcTokens_s { const char * token; - int colors; + rpm_color_t colors; }; /** @@ -535,7 +535,7 @@ static struct rpmfcTokens_s rpmfcTokens[] = { int rpmfcColoring(const char * fmstr) { rpmfcToken fct; - int fcolor = RPMFC_BLACK; + rpm_color_t fcolor = RPMFC_BLACK; for (fct = rpmfcTokens; fct->token != NULL; fct++) { if (strstr(fmstr, fct->token) == NULL) @@ -549,7 +549,7 @@ int rpmfcColoring(const char * fmstr) void rpmfcPrint(const char * msg, rpmfc fc, FILE * fp) { - int fcolor; + rpm_color_t fcolor; int ndx; int cx; int dx; @@ -1630,7 +1630,7 @@ assert(EVR != NULL); c = argiCount(fc->fcolor); assert(ac == c); if (p != NULL && c > 0) { - int32_t * fcolors = (int32_t *)p; + rpm_color_t * fcolors = (rpm_color_t *)p; int i; /* XXX Make sure only primary (i.e. Elf32/Elf64) colors are added. */ diff --git a/lib/depends.c b/lib/depends.c index 797a6df..8fea088 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -106,12 +106,12 @@ static int removePackage(rpmts ts, Header h, int dboffset, int rpmtsAddInstallElement(rpmts ts, Header h, fnpyKey key, int upgrade, rpmRelocation * relocs) { - uint32_t tscolor = rpmtsColor(ts); - uint32_t dscolor; - uint32_t hcolor; + rpm_color_t tscolor = rpmtsColor(ts); + rpm_color_t dscolor; + rpm_color_t hcolor; + rpm_color_t ohcolor; rpmdbMatchIterator mi; Header oh; - uint32_t ohcolor; int isSource; int duplicate = 0; rpmtsi pi = NULL; rpmte p; @@ -559,9 +559,9 @@ exit: */ static int checkPackageDeps(rpmts ts, const char * pkgNEVRA, rpmds requires, rpmds conflicts, - const char * depName, uint32_t tscolor, int adding) + const char * depName, rpm_color_t tscolor, int adding) { - uint32_t dscolor; + rpm_color_t dscolor; const char * Name; int rc; int ourrc = 0; @@ -1003,7 +1003,7 @@ static int orderListIndexCmp(const void * one, const void * two) static void addQ(rpmte p, rpmte * qp, rpmte * rp, - uint32_t prefcolor) + rpm_color_t prefcolor) { rpmte q, qprev; @@ -1045,7 +1045,7 @@ int rpmtsOrder(rpmts ts) { rpmds requires; rpmsenseFlags Flags; - uint32_t prefcolor = rpmtsPrefColor(ts); + rpm_color_t prefcolor = rpmtsPrefColor(ts); rpmtsi pi; rpmte p; rpmtsi qi; rpmte q; rpmtsi ri; rpmte r; @@ -1479,7 +1479,7 @@ assert(newOrderCount == ts->orderCount); int rpmtsCheck(rpmts ts) { - uint32_t tscolor = rpmtsColor(ts); + rpm_color_t tscolor = rpmtsColor(ts); rpmdbMatchIterator mi = NULL; rpmtsi pi = NULL; rpmte p; int closeatexit = 0; diff --git a/lib/psm.c b/lib/psm.c index aab0b36..6f9fe1f 100644 --- a/lib/psm.c +++ b/lib/psm.c @@ -1289,7 +1289,7 @@ static int rpmpsmNext(rpmpsm psm, pkgStage nstage) rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage) { const rpmts ts = psm->ts; - uint32_t tscolor = rpmtsColor(ts); + rpm_color_t tscolor = rpmtsColor(ts); rpmfi fi = psm->fi; HGE_t hge = fi->hge; HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData); diff --git a/lib/rpmal.c b/lib/rpmal.c index 7a47b6f..a835f81 100644 --- a/lib/rpmal.c +++ b/lib/rpmal.c @@ -23,7 +23,7 @@ struct availablePackage_s { rpmds provides; /*!< Provides: dependencies. */ rpmfi fi; /*!< File info set. */ - uint32_t tscolor; /*!< Transaction color bits. */ + rpm_color_t tscolor; /*!< Transaction color bits. */ fnpyKey key; /*!< Associated file name/python object */ @@ -64,7 +64,7 @@ struct fileIndexEntry_s { const char * baseName; /*!< File basename. */ int baseNameLen; rpmalNum pkgNum; /*!< Containing package index. */ - uint32_t ficolor; + rpm_color_t ficolor; }; typedef struct dirInfo_s * dirInfo; @@ -88,7 +88,7 @@ struct rpmal_s { int delta; /*!< Delta for pkg list reallocation. */ int size; /*!< No. of pkgs in list. */ int alloced; /*!< No. of pkgs allocated for list. */ - uint32_t tscolor; /*!< Transaction color. */ + rpm_color_t tscolor; /*!< Transaction color. */ int numDirs; /*!< No. of directories. */ dirInfo dirs; /*!< Set of directories. */ }; @@ -321,7 +321,7 @@ fprintf(stderr, " die[%5d] memset(%p,0,0x%lx)\n", al->numDirs, al->dirs + al- } rpmalKey rpmalAdd(rpmal * alistp, rpmalKey pkgKey, fnpyKey key, - rpmds provides, rpmfi fi, uint32_t tscolor) + rpmds provides, rpmfi fi, rpm_color_t tscolor) { rpmalNum pkgNum; rpmal al; @@ -505,9 +505,9 @@ static int indexcmp(const void * one, const void * two) return strcmp(a->entry, b->entry); } -void rpmalAddProvides(rpmal al, rpmalKey pkgKey, rpmds provides, uint32_t tscolor) +void rpmalAddProvides(rpmal al, rpmalKey pkgKey, rpmds provides, rpm_color_t tscolor) { - uint32_t dscolor; + rpm_color_t dscolor; const char * Name; rpmalNum pkgNum = alKey2Num(al, pkgKey); availableIndex ai = &al->index; @@ -578,8 +578,8 @@ void rpmalMakeIndex(rpmal al) fnpyKey * rpmalAllFileSatisfiesDepend(const rpmal al, const rpmds ds, rpmalKey * keyp) { - uint32_t tscolor; - uint32_t ficolor; + rpm_color_t tscolor; + rpm_color_t ficolor; int found = 0; char * dirName; const char * baseName; diff --git a/lib/rpmal.h b/lib/rpmal.h index da808c7..ebb5dab 100644 --- a/lib/rpmal.h +++ b/lib/rpmal.h @@ -56,7 +56,7 @@ rpmalKey rpmalAdd(rpmal * alistp, rpmalKey pkgKey, fnpyKey key, rpmds provides, rpmfi fi, - uint32_t tscolor); + rpm_color_t tscolor); /** * Add package provides to available list index. @@ -67,7 +67,7 @@ rpmalKey rpmalAdd(rpmal * alistp, */ void rpmalAddProvides(rpmal al, rpmalKey pkgKey, - rpmds provides, uint32_t tscolor); + rpmds provides, rpm_color_t tscolor); /** * Generate index for available list. diff --git a/lib/rpmds.c b/lib/rpmds.c index 62fd2e7..e6a3afe 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -32,7 +32,7 @@ struct rpmds_s { const char ** N; /*!< Name. */ const char ** EVR; /*!< Epoch-Version-Release. */ rpmsenseFlags * Flags; /*!< Bit(s) identifying context/comparison. */ - uint32_t * Color; /*!< Bit(s) calculated from file color(s). */ + rpm_color_t * Color; /*!< Bit(s) calculated from file color(s). */ int32_t * Refs; /*!< No. of file refs. */ time_t BT; /*!< Package build time tie breaker. */ rpm_tag_t tagN; /*!< Header tag. */ @@ -439,9 +439,9 @@ int rpmdsSetNoPromote(rpmds ds, int nopromote) return onopromote; } -uint32_t rpmdsColor(const rpmds ds) +rpm_color_t rpmdsColor(const rpmds ds) { - uint32_t Color = 0; + rpm_color_t Color = 0; if (ds != NULL && ds->i >= 0 && ds->i < ds->Count) { if (ds->Color != NULL) @@ -450,9 +450,9 @@ uint32_t rpmdsColor(const rpmds ds) return Color; } -uint32_t rpmdsSetColor(const rpmds ds, uint32_t color) +rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color) { - uint32_t ocolor = 0; + rpm_color_t ocolor = 0; if (ds != NULL && ds->i >= 0 && ds->i < ds->Count) { if (ds->Color != NULL) { diff --git a/lib/rpmds.h b/lib/rpmds.h index 75403bb..ef0d65c 100644 --- a/lib/rpmds.h +++ b/lib/rpmds.h @@ -258,7 +258,7 @@ uint32_t rpmdsColor(const rpmds ds); * @param color new dependency color * @return previous dependency color */ -uint32_t rpmdsSetColor(const rpmds ds, uint32_t color); +rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color); /** \ingroup rpmds * Return current dependency file refs. diff --git a/lib/rpmfi.c b/lib/rpmfi.c index b1e0126..05431bc 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -226,9 +226,9 @@ uint32_t rpmfiFInode(rpmfi fi) return finode; } -uint32_t rpmfiColor(rpmfi fi) +rpm_color_t rpmfiColor(rpmfi fi) { - uint32_t color = 0; + rpm_color_t color = 0; if (fi != NULL) /* XXX ignore all but lsnibble for now. */ @@ -236,9 +236,9 @@ uint32_t rpmfiColor(rpmfi fi) return color; } -uint32_t rpmfiFColor(rpmfi fi) +rpm_color_t rpmfiFColor(rpmfi fi) { - uint32_t fcolor = 0; + rpm_color_t fcolor = 0; if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) { if (fi->fcolors != NULL) @@ -634,8 +634,8 @@ Header relocateFileList(const rpmts ts, rpmfi fi, uint32_t * newDirIndexes; rpm_count_t fileCount, dirCount, numValid; uint32_t * fFlags = NULL; - uint32_t * fColors = NULL; - uint32_t * dColors = NULL; + rpm_color_t * fColors = NULL; + rpm_color_t * dColors = NULL; uint16_t * fModes = NULL; Header h; int nrelocated = 0; diff --git a/lib/rpmfi.h b/lib/rpmfi.h index 690b035..3dd202a 100644 --- a/lib/rpmfi.h +++ b/lib/rpmfi.h @@ -244,14 +244,14 @@ uint32_t rpmfiFInode(rpmfi fi); * @param fi file info set * @return current color */ -uint32_t rpmfiColor(rpmfi fi); +rpm_color_t rpmfiColor(rpmfi fi); /** \ingroup rpmfi * Return current file color bits from file info set. * @param fi file info set * @return current file color */ -uint32_t rpmfiFColor(rpmfi fi); +rpm_color_t rpmfiFColor(rpmfi fi); /** \ingroup rpmfi * Return current file class from file info set. diff --git a/lib/rpmfi_internal.h b/lib/rpmfi_internal.h index 30124fd..9060b18 100644 --- a/lib/rpmfi_internal.h +++ b/lib/rpmfi_internal.h @@ -58,7 +58,7 @@ struct rpmfi_s { char * fstates; /*!< File state(s) (from header) */ - const uint32_t * fcolors; /*!< File color bits (header) */ + const rpm_color_t * fcolors;/*!< File color bits (header) */ const char ** fcontexts; /*! FIle security contexts. */ @@ -117,7 +117,7 @@ struct rpmfi_s { int * fmapflags; FSM_t fsm; /*!< File state machine data. */ int keep_header; /*!< Keep header? */ - uint32_t color; /*!< Color bit(s) from file color union. */ + rpm_color_t color; /*!< Color bit(s) from file color union. */ sharedFileInfo replaced; /*!< (TR_ADDED) */ rpm_off_t * replacedSizes; /*!< (TR_ADDED) */ unsigned int record; /*!< (TR_REMOVED) */ diff --git a/lib/rpmte.c b/lib/rpmte.c index 3de5d1e..67c218d 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -285,14 +285,14 @@ int rpmteIsSource(rpmte te) return (te != NULL ? te->isSource : 0); } -uint32_t rpmteColor(rpmte te) +rpm_color_t rpmteColor(rpmte te) { return (te != NULL ? te->color : 0); } -uint32_t rpmteSetColor(rpmte te, uint32_t color) +rpm_color_t rpmteSetColor(rpmte te, rpm_color_t color) { - int ocolor = 0; + rpm_color_t ocolor = 0; if (te != NULL) { ocolor = te->color; te->color = color; @@ -512,9 +512,9 @@ void rpmteColorDS(rpmte te, rpm_tag_t tag) char deptype = 'R'; char mydt; const uint32_t * ddict; - int32_t * colors; + rpm_color_t * colors; int32_t * refs; - int32_t val; + rpm_color_t val; int Count; size_t nb; unsigned ix; diff --git a/lib/rpmte.h b/lib/rpmte.h index fa426a6..c379754 100644 --- a/lib/rpmte.h +++ b/lib/rpmte.h @@ -134,7 +134,7 @@ extern int rpmteIsSource(rpmte te); * @param te transaction element * @return color bits */ -uint32_t rpmteColor(rpmte te); +rpm_color_t rpmteColor(rpmte te); /** \ingroup rpmte * Set color bits of transaction element. @@ -142,7 +142,7 @@ uint32_t rpmteColor(rpmte te); * @param color new color bits * @return previous color bits */ -uint32_t rpmteSetColor(rpmte te, uint32_t color); +rpm_color_t rpmteSetColor(rpmte te, rpm_color_t color); /** \ingroup rpmte * Retrieve last instance installed to the database. diff --git a/lib/rpmte_internal.h b/lib/rpmte_internal.h index 2101b6d..8e3f604 100644 --- a/lib/rpmte_internal.h +++ b/lib/rpmte_internal.h @@ -54,7 +54,7 @@ struct rpmte_s { rpmds obsoletes; /*!< Obsoletes: dependencies. */ rpmfi fi; /*!< File information. */ - uint32_t color; /*!< Color bit(s) from package dependencies. */ + rpm_color_t color; /*!< Color bit(s) from package dependencies. */ rpm_off_t pkgFileSize; /*!< No. of bytes in package file (approx). */ fnpyKey key; /*!< (TR_ADDED) Retrieval key. */ diff --git a/lib/rpmts.c b/lib/rpmts.c index bb83da3..1918426 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -1462,14 +1462,14 @@ rpmte rpmtsSetRelocateElement(rpmts ts, rpmte relocateElement) return orelocateElement; } -uint32_t rpmtsColor(rpmts ts) +rpm_color_t rpmtsColor(rpmts ts) { return (ts != NULL ? ts->color : 0); } -uint32_t rpmtsSetColor(rpmts ts, uint32_t color) +rpm_color_t rpmtsSetColor(rpmts ts, rpm_color_t color) { - uint32_t ocolor = 0; + rpm_color_t ocolor = 0; if (ts != NULL) { ocolor = ts->color; ts->color = color; @@ -1477,7 +1477,7 @@ uint32_t rpmtsSetColor(rpmts ts, uint32_t color) return ocolor; } -uint32_t rpmtsPrefColor(rpmts ts) +rpm_color_t rpmtsPrefColor(rpmts ts) { return (ts != NULL ? ts->prefcolor : 0); } diff --git a/lib/rpmts.h b/lib/rpmts.h index 049629c..6908019 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -697,14 +697,14 @@ rpmte rpmtsSetRelocateElement(rpmts ts, rpmte relocateElement); * @param ts transaction set * @return color bits */ -uint32_t rpmtsColor(rpmts ts); +rpm_color_t rpmtsColor(rpmts ts); /** \ingroup rpmts * Retrieve prefered file color * @param ts transaction set * @return color bits */ -uint32_t rpmtsPrefColor(rpmts ts); +rpm_color_t rpmtsPrefColor(rpmts ts); /** \ingroup rpmts * Set color bits of transaction set. @@ -712,7 +712,7 @@ uint32_t rpmtsPrefColor(rpmts ts); * @param color new color bits * @return previous color bits */ -uint32_t rpmtsSetColor(rpmts ts, uint32_t color); +rpm_color_t rpmtsSetColor(rpmts ts, rpm_color_t color); /** \ingroup rpmts * Retrieve operation timestamp from a transaction set. diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h index 0af9f0f..ff0404f 100644 --- a/lib/rpmts_internal.h +++ b/lib/rpmts_internal.h @@ -92,8 +92,8 @@ struct rpmts_s { int delta; /*!< Delta for reallocation. */ int32_t tid; /*!< Transaction id. */ - uint32_t color; /*!< Transaction color bits. */ - uint32_t prefcolor; /*!< Preferred file color. */ + rpm_color_t color; /*!< Transaction color bits. */ + rpm_color_t prefcolor; /*!< Preferred file color. */ rpmVSFlags vsflags; /*!< Signature/digest verification flags. */ diff --git a/lib/rpmtypes.h b/lib/rpmtypes.h index a535b3b..a55b74a 100644 --- a/lib/rpmtypes.h +++ b/lib/rpmtypes.h @@ -24,6 +24,8 @@ typedef uint32_t rpm_count_t; typedef void * rpm_data_t; typedef const void * rpm_constdata_t; +typedef uint32_t rpm_color_t; + typedef uint32_t rpm_off_t; typedef uint32_t rpm_time_t; diff --git a/lib/transaction.c b/lib/transaction.c index 420457c..0aab854 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -72,10 +72,10 @@ static int handleInstInstalledFiles(const rpmts ts, sharedFileInfo shared, int sharedCount, int reportConflicts) { - uint32_t tscolor = rpmtsColor(ts); - uint32_t prefcolor = rpmtsPrefColor(ts); - uint32_t otecolor, tecolor; - uint32_t oFColor, FColor; + rpm_color_t tscolor = rpmtsColor(ts); + rpm_color_t prefcolor = rpmtsPrefColor(ts); + rpm_color_t otecolor, tecolor; + rpm_color_t oFColor, FColor; char * altNEVR = NULL; rpmfi otherFi = NULL; int numReplaced = 0; @@ -379,9 +379,9 @@ static void handleOverlappedFiles(const rpmts ts, fi = rpmfiInit(fi, 0); if (fi != NULL) while ((i = rpmfiNext(fi)) >= 0) { - uint32_t tscolor = rpmtsColor(ts); - uint32_t prefcolor = rpmtsPrefColor(ts); - uint32_t oFColor, FColor; + rpm_color_t tscolor = rpmtsColor(ts); + rpm_color_t prefcolor = rpmtsPrefColor(ts); + rpm_color_t oFColor, FColor; struct fingerPrint_s * fiFps; int otherPkgNum, otherFileNum; rpmfi otherFi; @@ -641,8 +641,8 @@ static int ensureOlder(rpmts ts, /* FIX: fi->actions is modified. */ static void skipFiles(const rpmts ts, rpmfi fi) { - uint32_t tscolor = rpmtsColor(ts); - uint32_t FColor; + rpm_color_t tscolor = rpmtsColor(ts); + rpm_color_t FColor; int noConfigs = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONFIGS); int noDocs = (rpmtsFlags(ts) & RPMTRANS_FLAG_NODOCS); char ** netsharedPaths = NULL; @@ -1288,7 +1288,7 @@ cleanup: int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) { - uint32_t tscolor = rpmtsColor(ts); + rpm_color_t tscolor = rpmtsColor(ts); int i, j; int ourrc = 0; int totalFileCount = 0; diff --git a/python/rpmts-py.c b/python/rpmts-py.c index e88bfa1..39fbc24 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -834,7 +834,7 @@ rpmts_GetVSFlags(rpmtsObject * s) static PyObject * rpmts_SetColor(rpmtsObject * s, PyObject * args, PyObject * kwds) { - uint32_t tscolor; + rpm_color_t tscolor; char * kwlist[] = {"color", NULL}; if (_rpmts_debug) diff --git a/rpmdb/hdrNVR.c b/rpmdb/hdrNVR.c index 04480a0..c7813bf 100644 --- a/rpmdb/hdrNVR.c +++ b/rpmdb/hdrNVR.c @@ -86,11 +86,11 @@ char * headerGetNEVRA(Header h, const char ** np) return NVRA; } -uint32_t headerGetColor(Header h) +rpm_color_t headerGetColor(Header h) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; - uint32_t hcolor = 0; - uint32_t * fcolors; + rpm_color_t hcolor = 0; + rpm_color_t * fcolors; rpm_count_t ncolors; int i; -- 2.7.4