From 36e9f885e161395e2dfb033dcd7db1667764f273 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 5 Feb 2008 15:29:37 +0200 Subject: [PATCH] Yet another typedef for transaction ID, use where spotted - most remaining [u]int16|32 uses are indexes and such, ie actual numbers --- lib/idtx.c | 4 ++-- lib/psm.c | 2 +- lib/rpmcli.h | 2 +- lib/rpmts.c | 12 ++++++------ lib/rpmts.h | 4 ++-- lib/rpmts_internal.h | 2 +- lib/rpmtypes.h | 1 + lib/tgi.c | 2 +- lib/transaction.c | 6 +++--- python/rpmts-py.c | 2 +- rpmdb/rpmdb.c | 4 ++-- tools/rpmcache.c | 4 ++-- 12 files changed, 23 insertions(+), 22 deletions(-) diff --git a/lib/idtx.c b/lib/idtx.c index 8a9f5c1..9e6d2bf 100644 --- a/lib/idtx.c +++ b/lib/idtx.c @@ -81,7 +81,7 @@ IDTX IDTXload(rpmts ts, rpm_tag_t tag) while ((h = rpmdbNextIterator(mi)) != NULL) { rpm_tagtype_t type = RPM_NULL_TYPE; rpm_count_t count = 0; - int32_t * tidp; + rpm_tid_t * tidp; tidp = NULL; if (!hge(h, tag, &type, (rpm_data_t *)&tidp, &count) || tidp == NULL) @@ -115,7 +115,7 @@ IDTX IDTXglob(rpmts ts, const char * globstr, rpm_tag_t tag) IDTX idtx = NULL; HGE_t hge = (HGE_t) headerGetEntry; Header h; - int32_t * tidp; + rpm_tid_t * tidp; FD_t fd; char ** av = NULL; int ac = 0; diff --git a/lib/psm.c b/lib/psm.c index 6f9fe1f..2e0ddc3 100644 --- a/lib/psm.c +++ b/lib/psm.c @@ -1588,7 +1588,7 @@ assert(psm->mi == NULL); /* Add remove transaction id to header. */ if (psm->oh != NULL) - { int32_t tid = rpmtsGetTid(ts); + { rpm_tid_t tid = rpmtsGetTid(ts); xx = headerAddEntry(psm->oh, RPMTAG_REMOVETID, RPM_INT32_TYPE, &tid, 1); } diff --git a/lib/rpmcli.h b/lib/rpmcli.h index 3936f15..0327b2e 100644 --- a/lib/rpmcli.h +++ b/lib/rpmcli.h @@ -422,7 +422,7 @@ struct rpmInstallArguments_s { rpmInstallInterfaceFlags installInterfaceFlags; rpmEraseInterfaceFlags eraseInterfaceFlags; rpmQueryFlags qva_flags; /*!< from --nodigest/--nosignature */ - uint32_t rbtid; /*!< from --rollback */ + rpm_tid_t rbtid; /*!< from --rollback */ int numRelocations; int noDeps; int incldocs; diff --git a/lib/rpmts.c b/lib/rpmts.c index 1918426..fdecf1b 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -497,7 +497,7 @@ rpmRC rpmtsImportPubkey(const rpmts ts, const unsigned char * pkt, size_t pktlen /* XXX W2DO: tag value inheirited from parent? */ xx = headerAddEntry(h, RPMTAG_BUILDHOST, RPM_STRING_TYPE, buildhost, 1); - { int32_t tid = rpmtsGetTid(ts); + { rpm_tid_t tid = rpmtsGetTid(ts); xx = headerAddEntry(h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE, &tid, 1); /* XXX W2DO: tag value inheirited from parent? */ xx = headerAddEntry(h, RPMTAG_BUILDTIME, RPM_INT32_TYPE, &tid, 1); @@ -1121,18 +1121,18 @@ int rpmtsSetChrootDone(rpmts ts, int chrootDone) return ochrootDone; } -int32_t rpmtsGetTid(rpmts ts) +rpm_tid_t rpmtsGetTid(rpmts ts) { - int32_t tid = -1; /* XXX -1 is time(2) error return. */ + rpm_tid_t tid = -1; /* XXX -1 is time(2) error return. */ if (ts != NULL) { tid = ts->tid; } return tid; } -int32_t rpmtsSetTid(rpmts ts, int32_t tid) +rpm_tid_t rpmtsSetTid(rpmts ts, rpm_tid_t tid) { - int32_t otid = -1; /* XXX -1 is time(2) error return. */ + rpm_tid_t otid = -1; /* XXX -1 is time(2) error return. */ if (ts != NULL) { otid = ts->tid; ts->tid = tid; @@ -1552,7 +1552,7 @@ rpmts rpmtsCreate(void) ts->dbmode = O_RDONLY; ts->scriptFd = NULL; - ts->tid = (int32_t) time(NULL); + ts->tid = (rpm_tid_t) time(NULL); ts->delta = 5; ts->color = rpmExpandNumeric("%{?_transaction_color}"); diff --git a/lib/rpmts.h b/lib/rpmts.h index 6908019..8b08619 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -507,7 +507,7 @@ int rpmtsSetChrootDone(rpmts ts, int chrootDone); * @param ts transaction set * @return transaction id */ -int32_t rpmtsGetTid(rpmts ts); +rpm_tid_t rpmtsGetTid(rpmts ts); /** \ingroup rpmts * Set transaction id, i.e. transaction time stamp. @@ -515,7 +515,7 @@ int32_t rpmtsGetTid(rpmts ts); * @param tid new transaction id * @return previous transaction id */ -int32_t rpmtsSetTid(rpmts ts, int32_t tid); +rpm_tid_t rpmtsSetTid(rpmts ts, rpm_tid_t tid); /** \ingroup rpmts * Get signature tag. diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h index ff0404f..c8d47ad 100644 --- a/lib/rpmts_internal.h +++ b/lib/rpmts_internal.h @@ -90,7 +90,7 @@ struct rpmts_s { char * currDir; /*!< Current working directory. */ FD_t scriptFd; /*!< Scriptlet stdout/stderr. */ int delta; /*!< Delta for reallocation. */ - int32_t tid; /*!< Transaction id. */ + rpm_tid_t tid; /*!< Transaction id. */ rpm_color_t color; /*!< Transaction color bits. */ rpm_color_t prefcolor; /*!< Preferred file color. */ diff --git a/lib/rpmtypes.h b/lib/rpmtypes.h index d673baf..499d042 100644 --- a/lib/rpmtypes.h +++ b/lib/rpmtypes.h @@ -34,6 +34,7 @@ typedef const void * rpm_constdata_t; typedef uint32_t rpm_color_t; typedef uint32_t rpm_flag_t; +typedef int32_t rpm_tid_t; /** @} */ /** \ingroup rpmtypes diff --git a/lib/tgi.c b/lib/tgi.c index 289b9c4..de28a6b 100644 --- a/lib/tgi.c +++ b/lib/tgi.c @@ -117,7 +117,7 @@ main(int argc, char *argv[]) vsflags |= RPMVSF_NOHDRCHK; (void) rpmtsSetVSFlags(ts, vsflags); - { int32_t tid = (int32_t) time(NULL); + { rpm_tid_t tid = (rpm_tid_t) time(NULL); (void) rpmtsSetTid(ts, tid); } diff --git a/lib/transaction.c b/lib/transaction.c index d23127f..3b32801 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -886,7 +886,7 @@ static rpmRC _rpmtsRollback(rpmts rollbackTransaction) int rc = 0; int numAdded = 0; int numRemoved = 0; - int32_t tid; + rpm_tid_t tid; rpmtsi tsi; rpmte te; rpmps ps; @@ -1009,7 +1009,7 @@ static rpmRC getRepackageHeaderFromTE(rpmts ts, rpmte te, Header *hdrp, const char **fnp) { - int32_t tid; + rpm_tid_t tid; const char * name; const char * rpname = NULL; const char * _repackage_dir = NULL; @@ -1375,7 +1375,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) (void) rpmtsSetChrootDone(ts, 0); - { int32_t tid = (int32_t) time(NULL); + { rpm_tid_t tid = (rpm_tid_t) time(NULL); (void) rpmtsSetTid(ts, tid); } diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 17b8d1f..16d1eae 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -584,7 +584,7 @@ rpmts_Rollback(rpmtsObject * s, PyObject * args, PyObject * kwds) struct rpmInstallArguments_s * ia = alloca(sizeof(*ia)); rpmtransFlags transFlags; const char ** av = NULL; - uint32_t rbtid; + rpm_tid_t rbtid; int rc; char * kwlist[] = {"transactionId", NULL}; diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index e564b4e..ac0bbc1 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -2450,7 +2450,7 @@ memset(data, 0, sizeof(*data)); #ifdef DYING /* Add remove transaction id to header. */ if (rid != 0 && rid != -1) { - int32_t tid = rid; + rpm_tid_t tid = rid; (void) headerAddEntry(h, RPMTAG_REMOVETID, RPM_INT32_TYPE, &tid, 1); } #endif @@ -2730,7 +2730,7 @@ memset(data, 0, sizeof(*data)); xx = headerRemoveEntry(h, RPMTAG_REMOVETID); #endif if (iid != 0 && iid != -1) { - int32_t tid = iid; + rpm_tid_t tid = iid; if (!headerIsEntry(h, RPMTAG_INSTALLTID)) xx = headerAddEntry(h, RPMTAG_INSTALLTID, RPM_INT32_TYPE, &tid, 1); } diff --git a/tools/rpmcache.c b/tools/rpmcache.c index 43bb2bf..23f08c0 100644 --- a/tools/rpmcache.c +++ b/tools/rpmcache.c @@ -107,7 +107,7 @@ static int ftsCachePrint(rpmts ts, FILE * fp) static int ftsCacheUpdate(rpmts ts) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; - int32_t tid = rpmtsGetTid(ts); + rpm_tid_t tid = rpmtsGetTid(ts); rpmdbMatchIterator mi; unsigned char * md5; int rc = 0; @@ -572,7 +572,7 @@ main(int argc, char *argv[]) vsflags |= RPMVSF_NOHDRCHK; (void) rpmtsSetVSFlags(ts, vsflags); - { int32_t tid = (int32_t) time(NULL); + { rpm_tid_t tid = (rpm_tid_t) time(NULL); (void) rpmtsSetTid(ts, tid); } -- 2.7.4