diff options
-rw-r--r-- | build/pack.c | 15 | ||||
-rw-r--r-- | debug.h | 9 | ||||
-rw-r--r-- | lib/depends.c | 2 | ||||
-rw-r--r-- | lib/fsm.c | 10 | ||||
-rw-r--r-- | lib/psm.c | 30 | ||||
-rw-r--r-- | lib/psm.h | 10 | ||||
-rw-r--r-- | lib/rpmal.c | 8 | ||||
-rw-r--r-- | lib/rpmchecksig.c | 4 | ||||
-rw-r--r-- | lib/rpmds.c | 12 | ||||
-rw-r--r-- | lib/rpmds.h | 14 | ||||
-rw-r--r-- | lib/rpmfi.c | 8 | ||||
-rw-r--r-- | lib/rpmfi.h | 22 | ||||
-rw-r--r-- | lib/rpmgi.c | 8 | ||||
-rw-r--r-- | lib/rpmgi.h | 13 | ||||
-rw-r--r-- | lib/rpminstall.c | 4 | ||||
-rw-r--r-- | lib/rpmps.c | 18 | ||||
-rw-r--r-- | lib/rpmps.h | 10 | ||||
-rw-r--r-- | lib/rpmte.c | 4 | ||||
-rw-r--r-- | lib/rpmts.c | 24 | ||||
-rw-r--r-- | lib/rpmts.h | 10 | ||||
-rw-r--r-- | lib/transaction.c | 2 | ||||
-rw-r--r-- | lib/verify.c | 4 | ||||
-rw-r--r-- | python/rpmfd-py.c | 6 | ||||
-rw-r--r-- | python/rpmte-py.c | 4 | ||||
-rw-r--r-- | rpmio/rpmio.c | 76 | ||||
-rw-r--r-- | rpmio/rpmio_internal.h | 9 |
26 files changed, 121 insertions, 215 deletions
diff --git a/build/pack.c b/build/pack.c index cea97b1cc..7299f687a 100644 --- a/build/pack.c +++ b/build/pack.c @@ -684,13 +684,14 @@ int packageBinaries(rpmSpec spec) memset(csa, 0, sizeof(*csa)); csa->cpioArchiveSize = 0; /* LCL: function typedefs */ - csa->cpioFdIn = fdNew("init (packageBinaries)"); - csa->cpioList = rpmfiLink(pkg->cpioList, "packageBinaries"); + csa->cpioFdIn = fdNew(RPMDBG_M("init (packageBinaries)")); + csa->cpioList = rpmfiLink(pkg->cpioList, RPMDBG_M("packageBinaries")); rc = writeRPM(&pkg->header, NULL, fn, csa, spec->passPhrase, NULL); csa->cpioList = rpmfiFree(csa->cpioList); - csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageBinaries)"); + csa->cpioFdIn = fdFree(csa->cpioFdIn, + RPMDBG_M("init (packageBinaries)")); fn = _free(fn); if (rc) return rc; @@ -723,15 +724,17 @@ int packageSources(rpmSpec spec) memset(csa, 0, sizeof(*csa)); csa->cpioArchiveSize = 0; /* LCL: function typedefs */ - csa->cpioFdIn = fdNew("init (packageSources)"); - csa->cpioList = rpmfiLink(spec->sourceCpioList, "packageSources"); + csa->cpioFdIn = fdNew(RPMDBG_M("init (packageSources)")); + csa->cpioList = rpmfiLink(spec->sourceCpioList, + RPMDBG_M("packageSources")); spec->sourcePkgId = NULL; rc = writeRPM(&spec->sourceHeader, &spec->sourcePkgId, fn, csa, spec->passPhrase, &(spec->cookie)); csa->cpioList = rpmfiFree(csa->cpioList); - csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageSources)"); + csa->cpioFdIn = fdFree(csa->cpioFdIn, + RPMDBG_M("init (packageSources)")); fn = _free(fn); } return rc; @@ -10,4 +10,13 @@ #include <dmalloc.h> #endif +#define RPMDBG_TOSTR(a) RPMDBG_TOSTR_ARG(a) +#define RPMDBG_TOSTR_ARG(a) #a + +#define RPMDBG() "at: " __FILE__ ":" RPMDBG_TOSTR (__LINE__) +#define RPMDBG_M_DEBUG(msg) msg " " RPMDBG() +#define RPMDBG_M_NODEBUG(msg) NULL + +#define RPMDBG_M(msg) RPMDBG_M_DEBUG(msg) + #endif /* H_DEBUG */ diff --git a/lib/depends.c b/lib/depends.c index cb5300b97..0d5d27d98 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -288,7 +288,7 @@ addheader: } mi = rpmdbFreeIterator(mi); - obsoletes = rpmdsLink(rpmteDS(p, RPMTAG_OBSOLETENAME), "Obsoletes"); + obsoletes = rpmdsLink(rpmteDS(p, RPMTAG_OBSOLETENAME), RPMDBG_M("Obsoletes")); obsoletes = rpmdsInit(obsoletes); if (obsoletes != NULL) while (rpmdsNext(obsoletes) >= 0) { @@ -94,7 +94,7 @@ static void * mapFreeIterator(void * p) if (iter) { /* XXX rpmswExit() */ iter->ts = rpmtsFree(iter->ts); - iter->fi = rpmfiUnlink(iter->fi, "mapIterator"); + iter->fi = rpmfiUnlink(iter->fi, RPMDBG_M("mapFreeIterator")); } return _free(p); } @@ -111,8 +111,8 @@ mapInitIterator(rpmts ts, rpmfi fi) FSMI_t iter = NULL; iter = xcalloc(1, sizeof(*iter)); - iter->ts = rpmtsLink(ts, "mapIterator"); - iter->fi = rpmfiLink(fi, "mapIterator"); + iter->ts = rpmtsLink(ts, RPMDBG_M("mapIterator")); + iter->fi = rpmfiLink(fi, RPMDBG_M("mapIterator")); iter->reverse = (rpmteType(fi->te) == TR_REMOVED && fi->action != FA_COPYOUT); iter->i = (iter->reverse ? (fi->fc - 1) : 0); iter->isave = iter->i; @@ -476,7 +476,7 @@ int fsmSetup(FSM_t fsm, fileStage goal, fsm->goal = goal; if (cfd != NULL) { - fsm->cfd = fdLink(cfd, "persist (fsm)"); + fsm->cfd = fdLink(cfd, RPMDBG_M("persist (fsm)")); pos = fdGetCpioPos(fsm->cfd); fdSetCpioPos(fsm->cfd, 0); } @@ -525,7 +525,7 @@ int fsmTeardown(FSM_t fsm) fsm->iter = mapFreeIterator(fsm->iter); if (fsm->cfd != NULL) { - fsm->cfd = fdFree(fsm->cfd, "persist (fsm)"); + fsm->cfd = fdFree(fsm->cfd, RPMDBG_M("persist (fsm)")); fsm->cfd = NULL; } fsm->failedFile = NULL; @@ -224,9 +224,9 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd, int i; memset(psm, 0, sizeof(*psm)); - psm->ts = rpmtsLink(ts, "InstallSourcePackage"); + psm->ts = rpmtsLink(ts, RPMDBG_M("InstallSourcePackage")); - rpmrc = rpmReadPackageFile(ts, fd, "InstallSourcePackage", &h); + rpmrc = rpmReadPackageFile(ts, fd, RPMDBG_M("InstallSourcePackage"), &h); switch (rpmrc) { case RPMRC_NOTTRUSTED: case RPMRC_NOKEY: @@ -269,13 +269,13 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd, } rpmteSetHeader(fi->te, fi->h); - fi->te->fd = fdLink(fd, "installSourcePackage"); + fi->te->fd = fdLink(fd, RPMDBG_M("installSourcePackage")); hge = fi->hge; hfd = fi->hfd; (void) rpmInstallLoadMacros(fi, fi->h); - psm->fi = rpmfiLink(fi, NULL); + psm->fi = rpmfiLink(fi, RPMDBG_M("rpmInstallLoadMacros")); psm->te = fi->te; if (cookie) { @@ -1142,34 +1142,33 @@ static const char * pkgStageString(pkgStage a) } } -rpmpsm XrpmpsmUnlink(rpmpsm psm, const char * msg, const char * fn, unsigned ln) +rpmpsm rpmpsmUnlink(rpmpsm psm, const char * msg) { if (psm == NULL) return NULL; if (_psm_debug && msg != NULL) -fprintf(stderr, "--> psm %p -- %d %s at %s:%u\n", psm, psm->nrefs, msg, fn, ln); +fprintf(stderr, "--> psm %p -- %d: %s\n", psm, psm->nrefs, msg); psm->nrefs--; return NULL; } -rpmpsm XrpmpsmLink(rpmpsm psm, const char * msg, const char * fn, unsigned ln) +rpmpsm rpmpsmLink(rpmpsm psm, const char * msg) { if (psm == NULL) return NULL; psm->nrefs++; if (_psm_debug && msg != NULL) -fprintf(stderr, "--> psm %p ++ %d %s at %s:%u\n", psm, psm->nrefs, msg, fn, ln); +fprintf(stderr, "--> psm %p ++ %d %s\n", psm, psm->nrefs, msg); return psm; } rpmpsm rpmpsmFree(rpmpsm psm) { - const char * msg = "rpmpsmFree"; if (psm == NULL) return NULL; if (psm->nrefs > 1) - return rpmpsmUnlink(psm, msg); + return rpmpsmUnlink(psm, RPMDBG_M("rpmpsmFree")); psm->fi = rpmfiFree(psm->fi); #ifdef NOTYET @@ -1179,7 +1178,7 @@ rpmpsm rpmpsmFree(rpmpsm psm) #endif psm->ts = rpmtsFree(psm->ts); - (void) rpmpsmUnlink(psm, msg); + (void) rpmpsmUnlink(psm, RPMDBG_M("rpmpsmFree")); memset(psm, 0, sizeof(*psm)); /* XXX trash and burn */ psm = _free(psm); @@ -1189,18 +1188,17 @@ rpmpsm rpmpsmFree(rpmpsm psm) rpmpsm rpmpsmNew(rpmts ts, rpmte te, rpmfi fi) { - const char * msg = "rpmpsmNew"; rpmpsm psm = xcalloc(1, sizeof(*psm)); - if (ts) psm->ts = rpmtsLink(ts, msg); + if (ts) psm->ts = rpmtsLink(ts, RPMDBG_M("rpmpsmNew")); #ifdef NOTYET - if (te) psm->te = rpmteLink(te, msg); + if (te) psm->te = rpmteLink(te, RPMDBG_M("rpmpsmNew")); #else if (te) psm->te = te; #endif - if (fi) psm->fi = rpmfiLink(fi, msg); + if (fi) psm->fi = rpmfiLink(fi, RPMDBG_M("rpmpsmNew")); - return rpmpsmLink(psm, msg); + return rpmpsmLink(psm, RPMDBG_M("rpmpsmNew")); } static void * rpmpsmThread(void * arg) @@ -109,11 +109,6 @@ extern "C" { rpmpsm rpmpsmUnlink (rpmpsm psm, const char * msg); -/** @todo Remove debugging entry from the ABI. */ -rpmpsm XrpmpsmUnlink (rpmpsm psm, - const char * msg, const char * fn, unsigned ln); -#define rpmpsmUnlink(_psm, _msg) XrpmpsmUnlink(_psm, _msg, __FILE__, __LINE__) - /** * Reference a package state machine instance. * @param psm package state machine @@ -122,11 +117,6 @@ rpmpsm XrpmpsmUnlink (rpmpsm psm, */ rpmpsm rpmpsmLink (rpmpsm psm, const char * msg); -/** @todo Remove debugging entry from the ABI. */ -rpmpsm XrpmpsmLink (rpmpsm psm, const char * msg, - const char * fn, unsigned ln); -#define rpmpsmLink(_psm, _msg) XrpmpsmLink(_psm, _msg, __FILE__, __LINE__) - /** * Destroy a package state machine. * @param psm package state machine diff --git a/lib/rpmal.c b/lib/rpmal.c index a2e42541c..403707a4a 100644 --- a/lib/rpmal.c +++ b/lib/rpmal.c @@ -354,10 +354,10 @@ rpmalKey rpmalAdd(rpmal * alistp, rpmalKey pkgKey, fnpyKey key, if (_rpmal_debug) fprintf(stderr, "*** add %p[%d] 0x%x\n", al->list, (int) pkgNum, tscolor); - alp->provides = rpmdsLink(provides, "Provides (rpmalAdd)"); - alp->fi = rpmfiLink(fi, "Files (rpmalAdd)"); + alp->provides = rpmdsLink(provides, RPMDBG_M("Provides (rpmalAdd)")); + alp->fi = rpmfiLink(fi, RPMDBG_M("Files (rpmalAdd)")); - fi = rpmfiLink(alp->fi, "Files index (rpmalAdd)"); + fi = rpmfiLink(alp->fi, RPMDBG_M("Files index (rpmalAdd)")); fi = rpmfiInit(fi, 0); if (rpmfiFC(fi) > 0) { dirInfo dieNeedle = @@ -483,7 +483,7 @@ fprintf(stderr, "\t%p[%3d] %p:%p[%2d] %s\n", die->files, die->numFiles, fie, fie if (origNumDirs != al->numDirs) qsort(al->dirs, al->numDirs, sizeof(*al->dirs), dieCompare); } - fi = rpmfiUnlink(fi, "Files index (rpmalAdd)"); + fi = rpmfiUnlink(fi, RPMDBG_M("Files index (rpmalAdd)")); rpmalFreeIndex(al); diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c index 4d38e9d4c..38aeee41c 100644 --- a/lib/rpmchecksig.c +++ b/lib/rpmchecksig.c @@ -61,8 +61,8 @@ static int manageFile(FD_t *fdp, } if (fnp != NULL) *fnp = fn; - *fdp = fdLink(fd, "manageFile return"); - fd = fdFree(fd, "manageFile return"); + *fdp = fdLink(fd, RPMDBG_M("manageFile return")); + fd = fdFree(fd, RPMDBG_M("manageFile return")); return 0; } diff --git a/lib/rpmds.c b/lib/rpmds.c index 2b9062484..a0bae296c 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -44,22 +44,22 @@ struct rpmds_s { int nopromote; /*!< Don't promote Epoch: in rpmdsCompare()? */ int nrefs; /*!< Reference count. */ }; -rpmds XrpmdsUnlink(rpmds ds, const char * msg, const char * fn, unsigned ln) +rpmds rpmdsUnlink(rpmds ds, const char * msg) { if (ds == NULL) return NULL; if (_rpmds_debug && msg != NULL) -fprintf(stderr, "--> ds %p -- %d %s at %s:%u\n", ds, ds->nrefs, msg, fn, ln); +fprintf(stderr, "--> ds %p -- %d %s\n", ds, ds->nrefs, msg); ds->nrefs--; return NULL; } -rpmds XrpmdsLink(rpmds ds, const char * msg, const char * fn, unsigned ln) +rpmds rpmdsLink(rpmds ds, const char * msg) { if (ds == NULL) return NULL; ds->nrefs++; if (_rpmds_debug && msg != NULL) -fprintf(stderr, "--> ds %p ++ %d %s at %s:%u\n", ds, ds->nrefs, msg, fn, ln); +fprintf(stderr, "--> ds %p ++ %d %s\n", ds, ds->nrefs, msg); return ds; } @@ -192,7 +192,7 @@ fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count); exit: /* FIX: ds->Flags may be NULL */ - ds = rpmdsLink(ds, (ds ? ds->Type : NULL)); + ds = rpmdsLink(ds, (ds ? ds->Type : RPMDBG())); return ds; } @@ -311,7 +311,7 @@ rpmds rpmdsThis(Header h, rpmTag tagN, int32_t Flags) } exit: - return rpmdsLink(ds, (ds ? ds->Type : NULL)); + return rpmdsLink(ds, (ds ? ds->Type : RPMDBG())); } rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, int32_t Flags) diff --git a/lib/rpmds.h b/lib/rpmds.h index d6e296d2b..c5bac3c1f 100644 --- a/lib/rpmds.h +++ b/lib/rpmds.h @@ -96,14 +96,7 @@ typedef enum rpmsenseFlags_e { * @param msg * @return NULL always */ -rpmds rpmdsUnlink (rpmds ds, - const char * msg); - -/** @todo Remove debugging entry from the ABI. */ -rpmds XrpmdsUnlink (rpmds ds, - const char * msg, const char * fn, unsigned ln); -#define rpmdsUnlink(_ds, _msg) XrpmdsUnlink(_ds, _msg, __FILE__, __LINE__) - +rpmds rpmdsUnlink (rpmds ds, const char * msg); /** \ingroup rpmds * Reference a dependency set instance. * @param ds dependency set @@ -112,11 +105,6 @@ rpmds XrpmdsUnlink (rpmds ds, */ rpmds rpmdsLink (rpmds ds, const char * msg); -/** @todo Remove debugging entry from the ABI. */ -rpmds XrpmdsLink (rpmds ds, const char * msg, - const char * fn, unsigned ln); -#define rpmdsLink(_ds, _msg) XrpmdsLink(_ds, _msg, __FILE__, __LINE__) - /** \ingroup rpmds * Destroy a dependency set. * @param ds dependency set diff --git a/lib/rpmfi.c b/lib/rpmfi.c index cb35aadae..b4462d13e 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -27,21 +27,21 @@ int _rpmfi_debug = 0; -rpmfi XrpmfiUnlink(rpmfi fi, const char * msg, const char * fn, unsigned ln) +rpmfi rpmfiUnlink(rpmfi fi, const char * msg) { if (fi == NULL) return NULL; if (_rpmfi_debug && msg != NULL) -fprintf(stderr, "--> fi %p -- %d %s at %s:%u\n", fi, fi->nrefs, msg, fn, ln); +fprintf(stderr, "--> fi %p -- %d %s\n", fi, fi->nrefs, msg); fi->nrefs--; return NULL; } -rpmfi XrpmfiLink(rpmfi fi, const char * msg, const char * fn, unsigned ln) +rpmfi rpmfiLink(rpmfi fi, const char * msg) { if (fi == NULL) return NULL; fi->nrefs++; if (_rpmfi_debug && msg != NULL) -fprintf(stderr, "--> fi %p ++ %d %s at %s:%u\n", fi, fi->nrefs, msg, fn, ln); +fprintf(stderr, "--> fi %p ++ %d %s\n", fi, fi->nrefs, msg); return fi; } diff --git a/lib/rpmfi.h b/lib/rpmfi.h index 12ce1679f..95e54ffed 100644 --- a/lib/rpmfi.h +++ b/lib/rpmfi.h @@ -95,17 +95,6 @@ typedef enum rpmFileAction_e { rpmfi rpmfiUnlink (rpmfi fi, const char * msg); -/** @todo Remove debugging entry from the ABI. - * @param fi file info set - * @param msg - * @param fn - * @param ln - * @return NULL always - */ -rpmfi XrpmfiUnlink (rpmfi fi, - const char * msg, const char * fn, unsigned ln); -#define rpmfiUnlink(_fi, _msg) XrpmfiUnlink(_fi, _msg, __FILE__, __LINE__) - /** \ingroup rpmfi * Reference a file info set instance. * @param fi file info set @@ -114,17 +103,6 @@ rpmfi XrpmfiUnlink (rpmfi fi, */ rpmfi rpmfiLink (rpmfi fi, const char * msg); -/** @todo Remove debugging entry from the ABI. - * @param fi file info set - * @param msg - * @param fn - * @param ln - * @return NULL always - */ -rpmfi XrpmfiLink (rpmfi fi, const char * msg, - const char * fn, unsigned ln); -#define rpmfiLink(_fi, _msg) XrpmfiLink(_fi, _msg, __FILE__, __LINE__) - /** \ingroup rpmfi * Return file count from file info set. * @param fi file info set diff --git a/lib/rpmgi.c b/lib/rpmgi.c index a7d3639d2..a8751961f 100644 --- a/lib/rpmgi.c +++ b/lib/rpmgi.c @@ -375,24 +375,24 @@ fprintf(stderr, "\tav %p[%ld]: \"%s\" -> %s ~= \"%s\"\n", gi->argv, (long) (av - return rpmrc; } -rpmgi XrpmgiUnlink(rpmgi gi, const char * msg, const char * fn, unsigned ln) +rpmgi rpmgiUnlink(rpmgi gi, const char * msg) { if (gi == NULL) return NULL; if (_rpmgi_debug && msg != NULL) -fprintf(stderr, "--> gi %p -- %d %s at %s:%u\n", gi, gi->nrefs, msg, fn, ln); +fprintf(stderr, "--> gi %p -- %d: %s\n", gi, gi->nrefs, msg); gi->nrefs--; return NULL; } -rpmgi XrpmgiLink(rpmgi gi, const char * msg, const char * fn, unsigned ln) +rpmgi rpmgiLink(rpmgi gi, const char * msg) { if (gi == NULL) return NULL; gi->nrefs++; if (_rpmgi_debug && msg != NULL) -fprintf(stderr, "--> gi %p ++ %d %s at %s:%u\n", gi, gi->nrefs, msg, fn, ln); +fprintf(stderr, "--> gi %p ++ %d: %s\n", gi, gi->nrefs, msg); return gi; } diff --git a/lib/rpmgi.h b/lib/rpmgi.h index 30f30fe48..4b4cf4252 100644 --- a/lib/rpmgi.h +++ b/lib/rpmgi.h @@ -49,13 +49,7 @@ extern rpmgiFlags giFlags; * @param msg * @return NULL always */ -rpmgi rpmgiUnlink (rpmgi gi, - const char * msg); - -/** @todo Remove debugging entry from the ABI. */ -rpmgi XrpmgiUnlink (rpmgi gi, - const char * msg, const char * fn, unsigned ln); -#define rpmgiUnlink(_gi, _msg) XrpmgiUnlink(_gi, _msg, __FILE__, __LINE__) +rpmgi rpmgiUnlink (rpmgi gi, const char * msg); /** \ingroup rpmgi * Reference a generalized iterator instance. @@ -65,11 +59,6 @@ rpmgi XrpmgiUnlink (rpmgi gi, */ rpmgi rpmgiLink (rpmgi gi, const char * msg); -/** @todo Remove debugging entry from the ABI. */ -rpmgi XrpmgiLink (rpmgi gi, const char * msg, - const char * fn, unsigned ln); -#define rpmgiLink(_gi, _msg) XrpmgiLink(_gi, _msg, __FILE__, __LINE__) - /** \ingroup rpmgi * Destroy a generalized iterator. * @param gi generalized iterator diff --git a/lib/rpminstall.c b/lib/rpminstall.c index 030b75f6c..885f666cc 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -100,13 +100,13 @@ void * rpmShowProgress(const void * arg, fd = NULL; } } else - fd = fdLink(fd, "persist (showProgress)"); + fd = fdLink(fd, RPMDBG_M("persist (showProgress)")); return (void *)fd; break; case RPMCALLBACK_INST_CLOSE_FILE: /* FIX: still necessary? */ - fd = fdFree(fd, "persist (showProgress)"); + fd = fdFree(fd, RPMDBG_M("persist (showProgress)")); if (fd != NULL) { xx = Fclose(fd); fd = NULL; diff --git a/lib/rpmps.c b/lib/rpmps.c index 133768bba..8f59ef0a4 100644 --- a/lib/rpmps.c +++ b/lib/rpmps.c @@ -39,21 +39,19 @@ struct rpmpsi_s { int _rpmps_debug = 0; -rpmps XrpmpsUnlink(rpmps ps, const char * msg, - const char * fn, unsigned ln) +rpmps rpmpsUnlink(rpmps ps, const char * msg) { if (_rpmps_debug > 0 && msg != NULL) -fprintf(stderr, "--> ps %p -- %d %s at %s:%u\n", ps, ps->nrefs, msg, fn, ln); +fprintf(stderr, "--> ps %p -- %d %s\n", ps, ps->nrefs, msg); ps->nrefs--; return ps; } -rpmps XrpmpsLink(rpmps ps, const char * msg, - const char * fn, unsigned ln) +rpmps rpmpsLink(rpmps ps, const char * msg) { ps->nrefs++; if (_rpmps_debug > 0 && msg != NULL) -fprintf(stderr, "--> ps %p ++ %d %s at %s:%u\n", ps, ps->nrefs, msg, fn, ln); +fprintf(stderr, "--> ps %p ++ %d %s\n", ps, ps->nrefs, msg); return ps; } @@ -70,7 +68,7 @@ rpmpsi rpmpsInitIterator(rpmps ps) rpmpsi psi = NULL; if (ps != NULL) { psi = xcalloc(1, sizeof(*psi)); - psi->ps = rpmpsLink(ps, "iter ref"); + psi->ps = rpmpsLink(ps, RPMDBG_M("rpmpsInitIterator")); psi->ix = -1; } return psi; @@ -79,7 +77,7 @@ rpmpsi rpmpsInitIterator(rpmps ps) rpmpsi rpmpsFreeIterator(rpmpsi psi) { if (psi != NULL) { - rpmpsUnlink(psi->ps, "iter unref"); + rpmpsUnlink(psi->ps, RPMDBG_M("rpmpsFreeIterator")); free(psi); psi = NULL; } @@ -112,13 +110,13 @@ rpmProblem rpmpsGetProblem(rpmpsi psi) rpmps rpmpsCreate(void) { rpmps ps = xcalloc(1, sizeof(*ps)); - return rpmpsLink(ps, "create"); + return rpmpsLink(ps, RPMDBG_M("rpmpsCreate")); } rpmps rpmpsFree(rpmps ps) { if (ps == NULL) return NULL; - ps = rpmpsUnlink(ps, "dereference"); + ps = rpmpsUnlink(ps, RPMDBG_M("rpmpsFree")); if (ps->nrefs > 0) return NULL; diff --git a/lib/rpmps.h b/lib/rpmps.h index 727487721..e2cb3018e 100644 --- a/lib/rpmps.h +++ b/lib/rpmps.h @@ -143,11 +143,6 @@ extern const char * rpmProblemString(const rpmProblem prob); rpmps rpmpsUnlink (rpmps ps, const char * msg); -/** @todo Remove debugging entry from the ABI. */ -rpmps XrpmpsUnlink (rpmps ps, - const char * msg, const char * fn, unsigned ln); -#define rpmpsUnlink(_ps, _msg) XrpmpsUnlink(_ps, _msg, __FILE__, __LINE__) - /** \ingroup rpmps * Reference a problem set instance. * @param ps transaction set @@ -156,11 +151,6 @@ rpmps XrpmpsUnlink (rpmps ps, */ rpmps rpmpsLink (rpmps ps, const char * msg); -/** @todo Remove debugging entry from the ABI. */ -rpmps XrpmpsLink (rpmps ps, - const char * msg, const char * fn, unsigned ln); -#define rpmpsLink(_ps, _msg) XrpmpsLink(_ps, _msg, __FILE__, __LINE__) - /** \ingroup rpmps * Return number of problems in set. * @param ps problem set diff --git a/lib/rpmte.c b/lib/rpmte.c index 4336b9726..c9dd66ea2 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -46,7 +46,7 @@ static void delTE(rpmte p) p->fi = rpmfiFree(p->fi); if (p->fd != NULL) - p->fd = fdFree(p->fd, "delTE"); + p->fd = fdFree(p->fd, RPMDBG_M("delTE")); p->os = _free(p->os); p->arch = _free(p->arch); @@ -594,7 +594,7 @@ rpmtsi XrpmtsiInit(rpmts ts, const char * fn, unsigned int ln) rpmtsi tsi = NULL; tsi = xcalloc(1, sizeof(*tsi)); - tsi->ts = rpmtsLink(ts, "rpmtsi"); + 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->ocsave = tsi->oc; diff --git a/lib/rpmts.c b/lib/rpmts.c index 19e4df9ca..db1c821e1 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -48,19 +48,19 @@ int _rpmts_debug = 0; int _rpmts_stats = 0; -rpmts XrpmtsUnlink(rpmts ts, const char * msg, const char * fn, unsigned ln) +rpmts rpmtsUnlink(rpmts ts, const char * msg) { if (_rpmts_debug) -fprintf(stderr, "--> ts %p -- %d %s at %s:%u\n", ts, ts->nrefs, msg, fn, ln); +fprintf(stderr, "--> ts %p -- %d %s\n", ts, ts->nrefs, msg); ts->nrefs--; return NULL; } -rpmts XrpmtsLink(rpmts ts, const char * msg, const char * fn, unsigned ln) +rpmts rpmtsLink(rpmts ts, const char * msg) { ts->nrefs++; if (_rpmts_debug) -fprintf(stderr, "--> ts %p ++ %d %s at %s:%u\n", ts, ts->nrefs, msg, fn, ln); +fprintf(stderr, "--> ts %p ++ %d %s\n", ts, ts->nrefs, msg); return ts; } @@ -798,7 +798,7 @@ rpmps rpmtsProblems(rpmts ts) rpmps ps = NULL; if (ts) { if (ts->probs) - ps = rpmpsLink(ts->probs, NULL); + ps = rpmpsLink(ts->probs, RPMDBG_M("rpmtsProblems")); } return ps; } @@ -908,7 +908,7 @@ rpmts rpmtsFree(rpmts ts) return NULL; if (ts->nrefs > 1) - return rpmtsUnlink(ts, "tsCreate"); + return rpmtsUnlink(ts, RPMDBG_M("tsCreate")); rpmtsEmpty(ts); @@ -924,7 +924,7 @@ rpmts rpmtsFree(rpmts ts) ts->dsi = _free(ts->dsi); if (ts->scriptFd != NULL) { - ts->scriptFd = fdFree(ts->scriptFd, "rpmtsFree"); + ts->scriptFd = fdFree(ts->scriptFd, RPMDBG_M("rpmtsFree")); ts->scriptFd = NULL; } ts->rootDir = _free(ts->rootDir); @@ -944,7 +944,7 @@ rpmts rpmtsFree(rpmts ts) /* Free up the memory used by the rpmtsScore */ ts->score = rpmtsScoreFree(ts->score); - (void) rpmtsUnlink(ts, "tsCreate"); + (void) rpmtsUnlink(ts, RPMDBG_M("tsCreate")); ts = _free(ts); @@ -1092,11 +1092,13 @@ void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd) if (ts != NULL) { if (ts->scriptFd != NULL) { - ts->scriptFd = fdFree(ts->scriptFd, "rpmtsSetScriptFd"); + ts->scriptFd = fdFree(ts->scriptFd, + RPMDBG_M("rpmtsSetScriptFd")); ts->scriptFd = NULL; } if (scriptFd != NULL) - ts->scriptFd = fdLink((void *)scriptFd, "rpmtsSetScriptFd"); + ts->scriptFd = fdLink((void *)scriptFd, + RPMDBG_M("rpmtsSetScriptFd")); } } @@ -1596,7 +1598,7 @@ rpmts rpmtsCreate(void) ts->nrefs = 0; - return rpmtsLink(ts, "tsCreate"); + return rpmtsLink(ts, RPMDBG_M("tsCreate")); } /********************** diff --git a/lib/rpmts.h b/lib/rpmts.h index 66499ac1f..85ee6bcc8 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -211,11 +211,6 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet); rpmts rpmtsUnlink (rpmts ts, const char * msg); -/** @todo Remove debugging entry from the ABI. */ -rpmts XrpmtsUnlink (rpmts ts, - const char * msg, const char * fn, unsigned ln); -#define rpmtsUnlink(_ts, _msg) XrpmtsUnlink(_ts, _msg, __FILE__, __LINE__) - /** \ingroup rpmts * Reference a transaction set instance. * @param ts transaction set @@ -224,11 +219,6 @@ rpmts XrpmtsUnlink (rpmts ts, */ rpmts rpmtsLink (rpmts ts, const char * msg); -/** @todo Remove debugging entry from the ABI. */ -rpmts XrpmtsLink (rpmts ts, - const char * msg, const char * fn, unsigned ln); -#define rpmtsLink(_ts, _msg) XrpmtsLink(_ts, _msg, __FILE__, __LINE__) - /** \ingroup rpmts * Close the database used by the transaction. * @param ts transaction set diff --git a/lib/transaction.c b/lib/transaction.c index f5a7553d4..cfede3b1b 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -2035,7 +2035,7 @@ assert(psm != NULL); p->fi = fi; } } - psm->fi = rpmfiLink(p->fi, NULL); + psm->fi = rpmfiLink(p->fi, RPMDBG_M("rpmtsRun")); /* FIX: psm->fi may be NULL */ if (rpmpsmStage(psm, PSM_PKGINSTALL)) { diff --git a/lib/verify.c b/lib/verify.c index d6f641cea..742341ae1 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -255,7 +255,7 @@ static int verifyHeader(QVA_t qva, const rpmts ts, rpmfi fi) te = t = buf; *te = '\0'; - fi = rpmfiLink(fi, "verifyHeader"); + fi = rpmfiLink(fi, RPMDBG_M("verifyHeader")); fi = rpmfiInit(fi, 0); if (fi != NULL) /* XXX lclint */ while ((i = rpmfiNext(fi)) >= 0) { @@ -338,7 +338,7 @@ static int verifyHeader(QVA_t qva, const rpmts ts, rpmfi fi) *t = '\0'; } } - fi = rpmfiUnlink(fi, "verifyHeader"); + fi = rpmfiUnlink(fi, RPMDBG_M("verifyHeader")); return ec; } diff --git a/python/rpmfd-py.c b/python/rpmfd-py.c index 7ba66b9f9..a69cba27d 100644 --- a/python/rpmfd-py.c +++ b/python/rpmfd-py.c @@ -73,10 +73,10 @@ static int closeCallback(FILE * f) else fdhead = node->next; node->note = _free (node->note); - node->fd = fdLink(node->fd, "closeCallback"); + node->fd = fdLink(node->fd, RPMDBG_M("closeCallback")); (void) Fclose (node->fd); while (node->fd) - node->fd = fdFree(node->fd, "closeCallback"); + node->fd = fdFree(node->fd, RPMDBG_M("closeCallback")); node = _free (node); } return 0; @@ -98,7 +98,7 @@ rpmfd_Fopen(PyObject * s, PyObject * args, PyObject * kwds) node = xmalloc (sizeof(FDlist)); node->fd = Fopen(path, mode); - node->fd = fdLink(node->fd, "doFopen"); + node->fd = fdLink(node->fd, RPMDBG_M("doFopen")); node->note = xstrdup (path); if (!node->fd) { diff --git a/python/rpmte-py.c b/python/rpmte-py.c index 833302f08..95131854a 100644 --- a/python/rpmte-py.c +++ b/python/rpmte-py.c @@ -210,7 +210,7 @@ rpmte_DS(rpmteObject * s, PyObject * args, PyObject * kwds) return Py_None; #endif } - return (PyObject *) rpmds_Wrap(rpmdsLink(ds, "rpmte_DS")); + return (PyObject *) rpmds_Wrap(rpmdsLink(ds, RPMDBG_M("rpmte_DS"))); } static PyObject * @@ -240,7 +240,7 @@ rpmte_FI(rpmteObject * s, PyObject * args, PyObject * kwds) return Py_None; #endif } - return (PyObject *) rpmfi_Wrap(rpmfiLink(fi, "rpmte_FI")); + return (PyObject *) rpmfi_Wrap(rpmfiLink(fi, RPMDBG_M("rpmte_FI"))); } /** \ingroup py_c diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c index d12dee61b..0aae1f705 100644 --- a/rpmio/rpmio.c +++ b/rpmio/rpmio.c @@ -149,7 +149,7 @@ FD_t fdDup(int fdno) if ((nfdno = dup(fdno)) < 0) return NULL; - fd = fdNew("open (fdDup)"); + fd = fdNew(RPMDBG_M("open (fdDup)")); fdSetFdno(fd, nfdno); DBGIO(fd, (stderr, "==> fdDup(%d) fd %p %s\n", fdno, (fd ? fd : NULL), fdbg(fd))); return fd; @@ -181,16 +181,7 @@ FILE * fdGetFILE(FD_t fd) /* =============================================================== */ -/** - */ -FD_t fdLink (void * cookie, const char * msg) -{ - return fdio->_fdref(cookie, msg); -} - -/** - */ -static inline FD_t XfdLink(void * cookie, const char * msg) +FD_t fdLink(void * cookie, const char * msg) { FD_t fd; if (cookie == NULL) @@ -205,24 +196,15 @@ DBGREFS(fd, (stderr, "--> fd %p ++ %d %s %s\n", fd, fd->nrefs, msg, fdbg(fd))) /** */ -FD_t fdFree(FD_t fd, const char * msg) -{ - return fdio->_fdderef(fd, msg, __FILE__, __LINE__); -} - -/** - */ -static inline -FD_t XfdFree( FD_t fd, const char *msg, - const char *file, unsigned line) +FD_t fdFree( FD_t fd, const char *msg) { int i; if (fd == NULL) -DBGREFS(0, (stderr, "--> fd %p -- %d %s at %s:%u\n", fd, FDNREFS(fd), msg, file, line)); +DBGREFS(0, (stderr, "--> fd %p -- %d %s\n", fd, FDNREFS(fd), msg)); FDSANE(fd); if (fd) { -DBGREFS(fd, (stderr, "--> fd %p -- %d %s at %s:%u %s\n", fd, fd->nrefs, msg, file, line, fdbg(fd))); +DBGREFS(fd, (stderr, "--> fd %p -- %d %s %s\n", fd, fd->nrefs, msg, fdbg(fd))); if (--fd->nrefs > 0) return fd; fd->stats = _free(fd->stats); @@ -241,15 +223,7 @@ DBGREFS(fd, (stderr, "--> fd %p -- %d %s at %s:%u %s\n", fd, fd->nrefs, msg, fi /** */ -FD_t fdNew (const char * msg) -{ - return fdio->_fdnew(msg, __FILE__, __LINE__); -} - -/** - */ -static inline -FD_t XfdNew(const char * msg, const char * file, unsigned line) +FD_t fdNew(const char * msg) { FD_t fd = xcalloc(1, sizeof(*fd)); if (fd == NULL) /* XXX xmalloc never returns NULL */ @@ -280,7 +254,7 @@ FD_t XfdNew(const char * msg, const char * file, unsigned line) fd->fileSize = 0; fd->fd_cpioPos = 0; - return XfdLink(fd, msg); + return fdLink(fd, msg); } /** @@ -383,7 +357,7 @@ static FD_t fdOpen(const char *path, int flags, mode_t mode) (void) close(fdno); return NULL; } - fd = fdNew("open (fdOpen)"); + fd = fdNew(RPMDBG_M("open (fdOpen)")); fdSetFdno(fd, fdno); fd->flags = flags; DBGIO(fd, (stderr, "==>\tfdOpen(\"%s\",%x,0%o) %s\n", path, (unsigned)flags, (unsigned)mode, fdbg(fd))); @@ -391,7 +365,7 @@ DBGIO(fd, (stderr, "==>\tfdOpen(\"%s\",%x,0%o) %s\n", path, (unsigned)flags, (un } static struct FDIO_s fdio_s = { - fdRead, fdWrite, fdSeek, fdClose, XfdLink, XfdFree, XfdNew, fdFileno, + fdRead, fdWrite, fdSeek, fdClose, fdLink, fdFree, fdNew, fdFileno, fdOpen, NULL, fdGetFp, NULL, mkdir, chdir, rmdir, rename, unlink }; FDIO_t fdio = &fdio_s ; @@ -838,7 +812,7 @@ DBGIO(fd, (stderr, "==>\tufdOpen(\"%s\",%x,0%o) %s\n", url, (unsigned)flags, (un } static struct FDIO_s ufdio_s = { - ufdRead, ufdWrite, ufdSeek, ufdClose, XfdLink, XfdFree, XfdNew, fdFileno, + ufdRead, ufdWrite, ufdSeek, ufdClose, fdLink, fdFree, fdNew, fdFileno, ufdOpen, NULL, fdGetFp, NULL, mkdir, chdir, rmdir, rename, unlink }; FDIO_t ufdio = &ufdio_s ; @@ -879,11 +853,11 @@ FD_t gzdOpen(const char * path, const char * fmode) gzFile gzfile; if ((gzfile = gzopen(path, fmode)) == NULL) return NULL; - fd = fdNew("open (gzdOpen)"); + fd = fdNew(RPMDBG_M("open (gzdOpen)")); fdPop(fd); fdPush(fd, gzdio, gzfile, -1); DBGIO(fd, (stderr, "==>\tgzdOpen(\"%s\", \"%s\") fd %p %s\n", path, fmode, (fd ? fd : NULL), fdbg(fd))); - return fdLink(fd, "gzdOpen"); + return fdLink(fd, RPMDBG_M("gzdOpen")); } static FD_t gzdFdopen(void * cookie, const char *fmode) @@ -901,7 +875,7 @@ static FD_t gzdFdopen(void * cookie, const char *fmode) fdPush(fd, gzdio, gzfile, fdno); /* Push gzdio onto stack */ - return fdLink(fd, "gzdFdopen"); + return fdLink(fd, RPMDBG_M("gzdFdopen")); } static int gzdFlush(FD_t fd) @@ -1039,12 +1013,12 @@ DBGIO(fd, (stderr, "==>\tgzdClose(%p) rc %lx %s\n", cookie, (unsigned long)rc, f if (_rpmio_debug || rpmIsDebug()) fdstat_print(fd, "GZDIO", stderr); if (rc == 0) - fd = fdFree(fd, "open (gzdClose)"); + fd = fdFree(fd, RPMDBG_M("open (gzdClose)")); return rc; } static struct FDIO_s gzdio_s = { - gzdRead, gzdWrite, gzdSeek, gzdClose, XfdLink, XfdFree, XfdNew, fdFileno, + gzdRead, gzdWrite, gzdSeek, gzdClose, fdLink, fdFree, fdNew, fdFileno, NULL, gzdOpen, gzdFileno, gzdFlush, NULL, NULL, NULL, NULL, NULL }; FDIO_t gzdio = &gzdio_s ; @@ -1091,9 +1065,9 @@ static FD_t bzdOpen(const char * path, const char * mode) BZFILE *bzfile;; if ((bzfile = bzopen(path, mode)) == NULL) return NULL; - fd = fdNew("open (bzdOpen)"); + fd = fdNew(RPMDBG_M("open (bzdOpen)")); fdPop(fd); fdPush(fd, bzdio, bzfile, -1); - return fdLink(fd, "bzdOpen"); + return fdLink(fd, RPMDBG_M("bzdOpen")); } static FD_t bzdFdopen(void * cookie, const char * fmode) @@ -1111,7 +1085,7 @@ static FD_t bzdFdopen(void * cookie, const char * fmode) fdPush(fd, bzdio, bzfile, fdno); /* Push bzdio onto stack */ - return fdLink(fd, "bzdFdopen"); + return fdLink(fd, RPMDBG_M("bzdFdopen")); } static int bzdFlush(FD_t fd) @@ -1202,12 +1176,12 @@ DBGIO(fd, (stderr, "==>\tbzdClose(%p) rc %lx %s\n", cookie, (unsigned long)rc, f if (_rpmio_debug || rpmIsDebug()) fdstat_print(fd, "BZDIO", stderr); if (rc == 0) - fd = fdFree(fd, "open (bzdClose)"); + fd = fdFree(fd, RPMDBG_M("open (bzdClose)")); return rc; } static struct FDIO_s bzdio_s = { - bzdRead, bzdWrite, bzdSeek, bzdClose, XfdLink, XfdFree, XfdNew, fdFileno, + bzdRead, bzdWrite, bzdSeek, bzdClose, fdLink, fdFree, fdNew, fdFileno, NULL, bzdOpen, bzdFileno, bzdFlush, NULL, NULL, NULL, NULL, NULL }; FDIO_t bzdio = &bzdio_s ; @@ -1323,7 +1297,7 @@ int Fclose(FD_t fd) FDSANE(fd); DBGIO(fd, (stderr, "==> Fclose(%p) %s\n", (fd ? fd : NULL), fdbg(fd))); - fd = fdLink(fd, "Fclose"); + fd = fdLink(fd, RPMDBG_M("Fclose")); while (fd->nfps >= 0) { FDSTACK_t * fps = &fd->fps[fd->nfps]; @@ -1336,7 +1310,7 @@ DBGIO(fd, (stderr, "==> Fclose(%p) %s\n", (fd ? fd : NULL), fdbg(fd))); if (fp) rc = fclose(fp); if (fpno == -1) { - fd = fdFree(fd, "fopencookie (Fclose)"); + fd = fdFree(fd, RPMDBG_M("fopencookie (Fclose)")); fdPop(fd); } } else { @@ -1349,7 +1323,7 @@ DBGIO(fd, (stderr, "==> Fclose(%p) %s\n", (fd ? fd : NULL), fdbg(fd))); ec = rc; fdPop(fd); } - fd = fdFree(fd, "Fclose"); + fd = fdFree(fd, RPMDBG_M("Fclose")); return ec; } @@ -1517,7 +1491,7 @@ DBGIO(fd, (stderr, "==> fopencookie(%p,\"%s\",*%p) returns fp %p\n", fd, stdio, if (fdGetFp(fd) == NULL) fdSetFp(fd, fp); fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */ - fd = fdLink(fd, "fopencookie"); + fd = fdLink(fd, RPMDBG_M("fopencookie")); } } @@ -1712,7 +1686,7 @@ exit: } static struct FDIO_s fpio_s = { - ufdRead, ufdWrite, fdSeek, ufdClose, XfdLink, XfdFree, XfdNew, fdFileno, + ufdRead, ufdWrite, fdSeek, ufdClose, fdLink, fdFree, fdNew, fdFileno, ufdOpen, NULL, fdGetFp, NULL, mkdir, chdir, rmdir, rename, unlink }; FDIO_t fpio = &fpio_s ; diff --git a/rpmio/rpmio_internal.h b/rpmio/rpmio_internal.h index 1d8322561..256fc2c85 100644 --- a/rpmio/rpmio_internal.h +++ b/rpmio/rpmio_internal.h @@ -93,19 +93,16 @@ typedef int (*fdio_close_function_t) (void *cookie); /** */ -typedef FD_t (*fdio_ref_function_t) ( void * cookie, - const char * msg); +typedef FD_t (*fdio_ref_function_t) ( void * cookie, const char * msg); /** */ -typedef FD_t (*fdio_deref_function_t) ( FD_t fd, - const char * msg, const char * file, unsigned line); +typedef FD_t (*fdio_deref_function_t) ( FD_t fd, const char * msg); /** */ -typedef FD_t (*fdio_new_function_t) (const char * msg, - const char * file, unsigned line); +typedef FD_t (*fdio_new_function_t) (const char * msg); /** |