RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 21-Mar-2009 22:53:41 Branch: HEAD Handle: 2009032121534000 Modified files: rpm CHANGES rpm/lib librpm.vers rpmsx.c rpmsx.h rpmte.c rpmte.h Log: - yarn: wire up rpmteFini, eliminate rpmteFree. - yarn: wire up rpmsxFini, eliminate rpmsxFree. Summary: Revision Changes Path 1.2861 +2 -0 rpm/CHANGES 1.65 +0 -2 rpm/lib/librpm.vers 2.26 +33 -46 rpm/lib/rpmsx.c 2.17 +4 -4 rpm/lib/rpmsx.h 2.96 +20 -22 rpm/lib/rpmte.c 2.63 +3 -1 rpm/lib/rpmte.h ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.2860 -r1.2861 CHANGES --- rpm/CHANGES 21 Mar 2009 20:54:22 -0000 1.2860 +++ rpm/CHANGES 21 Mar 2009 21:53:40 -0000 1.2861 @@ -1,5 +1,7 @@ 5.2a3 -> 5.2a4: + - jbj: yarn: wire up rpmteFini, eliminate rpmteFree. + - jbj: yarn: wire up rpmsxFini, eliminate rpmsxFree. - jbj: yarn: wire up rpmfiFini, eliminate rpmfiFree. - jbj: yarn: wire up rpmgiFini, eliminate rpmgiFree. - jbj: rpmtsi: use __FUNCTION__ rather than adding a 2nd arg everywhere. @@ . patch -p0 <<'@@ .' Index: rpm/lib/librpm.vers ============================================================================ $ cvs diff -u -r1.64 -r1.65 librpm.vers --- rpm/lib/librpm.vers 21 Mar 2009 20:54:23 -0000 1.64 +++ rpm/lib/librpm.vers 21 Mar 2009 21:53:40 -0000 1.65 @@ -261,7 +261,6 @@ _rpmsx_debug; rpmsxFContext; rpmsxFMode; - rpmsxFree; rpmsxFStem; rpmsxInit; rpmsxIx; @@ -290,7 +289,6 @@ rpmteFd; rpmteFI; rpmteFlink; - rpmteFree; rpmteFreeTSI; rpmteHdrid; rpmteHeader; @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmsx.c ============================================================================ $ cvs diff -u -r2.25 -r2.26 rpmsx.c --- rpm/lib/rpmsx.c 20 Mar 2009 18:28:33 -0000 2.25 +++ rpm/lib/rpmsx.c 21 Mar 2009 21:53:40 -0000 2.26 @@ -20,23 +20,6 @@ /*...@unchecked@*/ int _rpmsx_debug = 0; - -/*...@unchecked@*/ /*...@null@*/ -rpmioPool _rpmsxPool; - -static rpmsx rpmsxGetPool(/*...@null@*/ rpmioPool pool) - /*...@modifies pool @*/ -{ - rpmsx sx; - - if (_rpmsxPool == NULL) { - _rpmsxPool = rpmioNewPool("sx", sizeof(*sx), -1, _rpmsx_debug, - NULL, NULL, NULL); - pool = _rpmsxPool; - } - return (rpmsx) rpmioGetPool(pool, sizeof(*sx)); -} - /** * Stable sort for policy specifications, patterns before paths. * @param sx security context patterns @@ -220,41 +203,45 @@ return -1; } -rpmsx rpmsxFree(rpmsx sx) +static void rpmsxFini(void * _sx) + /*...@modifies *_sx @*/ { + rpmsx sx = _sx; int i; - if (sx == NULL) - return NULL; + if (sx->Count > 0) + for (i = 0; i < sx->Count; i++) { + rpmsxp sxp = sx->sxp + i; + sxp->pattern = _free(sxp->pattern); + sxp->type = _free(sxp->type); + sxp->context = _free(sxp->context); +/*...@i@*/ regfree(sxp->preg); +/*...@i@*/ sxp->preg = _free(sxp->preg); + } + sx->sxp = _free(sx->sxp); + + if (sx->nsxs > 0) + for (i = 0; i < sx->nsxs; i++) { + rpmsxs sxs = sx->sxs + i; + sxs->stem = _free(sxs->stem); + } + sx->sxs = _free(sx->sxs); +} - yarnPossess(sx->_item.use); -/*...@-modfilesys@*/ -if (_rpmsx_debug) -fprintf(stderr, "--> sx %p -- %ld %s at %s:%u\n", sx, yarnPeekLock(sx->_item.use), "rpmsxFree", __FILE__, __LINE__); -/*...@=modfilesys@*/ +/*...@unchecked@*/ /*...@null@*/ +rpmioPool _rpmsxPool; - if (yarnPeekLock(sx->_item.use) <= -1L) { - if (sx->Count > 0) - for (i = 0; i < sx->Count; i++) { - rpmsxp sxp = sx->sxp + i; - sxp->pattern = _free(sxp->pattern); - sxp->type = _free(sxp->type); - sxp->context = _free(sxp->context); -/*...@i@*/ regfree(sxp->preg); -/*...@i@*/ sxp->preg = _free(sxp->preg); - } - sx->sxp = _free(sx->sxp); +static rpmsx rpmsxGetPool(/*...@null@*/ rpmioPool pool) + /*...@modifies pool @*/ +{ + rpmsx sx; - if (sx->nsxs > 0) - for (i = 0; i < sx->nsxs; i++) { - rpmsxs sxs = sx->sxs + i; - sxs->stem = _free(sxs->stem); - } - sx->sxs = _free(sx->sxs); - sx = (rpmsx) rpmioPutPool((rpmioItem)sx); - } else - yarnTwist(sx->_item.use, BY, -1); - return NULL; + if (_rpmsxPool == NULL) { + _rpmsxPool = rpmioNewPool("sx", sizeof(*sx), -1, _rpmsx_debug, + NULL, NULL, rpmsxFini); + pool = _rpmsxPool; + } + return (rpmsx) rpmioGetPool(pool, sizeof(*sx)); } /** @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmsx.h ============================================================================ $ cvs diff -u -r2.16 -r2.17 rpmsx.h --- rpm/lib/rpmsx.h 20 Mar 2009 18:28:33 -0000 2.16 +++ rpm/lib/rpmsx.h 21 Mar 2009 21:53:40 -0000 2.17 @@ -90,7 +90,7 @@ /*...@null@*/ const char * msg) /*...@modifies sx @*/; #define rpmsxUnlink(_sx, _msg) \ - ((rpmsx)rpmioUnlinkPoolItem((rpmioItem)(_sx), _msg, __FILE__, __LINE__)) + ((rpmsx)rpmioUnlinkPoolItem((rpmioItem)(_sx), _msg, __FILE__, __LINE__)) /** * Reference a security context patterns instance. @@ -102,18 +102,18 @@ rpmsx rpmsxLink (/*...@null@*/ rpmsx sx, /*...@null@*/ const char * msg) /*...@modifies sx @*/; #define rpmsxLink(_sx, _msg) \ - ((rpmsx)rpmioLinkPoolItem((rpmioItem)(_sx), _msg, __FILE__, __LINE__)) + ((rpmsx)rpmioLinkPoolItem((rpmioItem)(_sx), _msg, __FILE__, __LINE__)) /** * Destroy a security context patterns. * @param sx security context patterns * @return NULL always */ -/*...@-exportlocal@*/ /*...@null@*/ rpmsx rpmsxFree(/*...@killref@*/ /*...@only@*/ /*...@null@*/ rpmsx sx) /*...@modifies s...@*/; -/*...@=exportlocal@*/ +#define rpmsxFree(_sx) \ + ((rpmsx)rpmioFreePoolItem((rpmioItem)(_sx), __FUNCTION__, __FILE__, __LINE__)) /** * Parse selinux file security context patterns. @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmte.c ============================================================================ $ cvs diff -u -r2.95 -r2.96 rpmte.c --- rpm/lib/rpmte.c 21 Mar 2009 17:32:45 -0000 2.95 +++ rpm/lib/rpmte.c 21 Mar 2009 21:53:40 -0000 2.96 @@ -26,22 +26,6 @@ /*...@access rpmts @*/ /* XXX cast */ /*...@access rpmtsi @*/ -/*...@unchecked@*/ /*...@null@*/ -rpmioPool _rpmtePool; - -static rpmte rpmteGetPool(/*...@null@*/ rpmioPool pool) - /*...@modifies pool @*/ -{ - rpmte te; - - if (_rpmtePool == NULL) { - _rpmtePool = rpmioNewPool("te", sizeof(*te), -1, _rpmte_debug, - NULL, NULL, NULL); - pool = _rpmtePool; - } - return (rpmte) rpmioGetPool(pool, sizeof(*te)); -} - void rpmteCleanDS(rpmte te) { te->PRCO = rpmdsFreePRCO(te->PRCO); @@ -219,14 +203,28 @@ /*...@=compdef@*/ } -rpmte rpmteFree(rpmte te) +static void rpmteFini(void * _te) + /*...@modifies *_te @*/ { - if (te != NULL) { - yarnPossess(te->_item.use); /* XXX no refcounts, rpioPutPool expects locked. */ - delTE(te); - te = (rpmte)rpmioPutPool((rpmioItem)te); + rpmte te = _te; + + delTE(te); +} + +/*...@unchecked@*/ /*...@null@*/ +rpmioPool _rpmtePool; + +static rpmte rpmteGetPool(/*...@null@*/ rpmioPool pool) + /*...@modifies pool @*/ +{ + rpmte te; + + if (_rpmtePool == NULL) { + _rpmtePool = rpmioNewPool("te", sizeof(*te), -1, _rpmte_debug, + NULL, NULL, rpmteFini); + pool = _rpmtePool; } - return NULL; + return (rpmte) rpmioGetPool(pool, sizeof(*te)); } rpmte rpmteNew(const rpmts ts, Header h, @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmte.h ============================================================================ $ cvs diff -u -r2.62 -r2.63 rpmte.h --- rpm/lib/rpmte.h 21 Mar 2009 20:15:39 -0000 2.62 +++ rpm/lib/rpmte.h 21 Mar 2009 21:53:40 -0000 2.63 @@ -202,10 +202,12 @@ * @param te transaction element * @return NULL always */ -/*...@null@*/ +/*...@unused@*/ /*...@null@*/ rpmte rpmteFree(/*...@only@*/ /*...@null@*/ rpmte te) /*...@globals fileSystem @*/ /*...@modifies te, fileSystem @*/; +#define rpmteFree(_te) \ + ((rpmte) rpmioFreePoolItem((rpmioItem)(_te), __FUNCTION__, __FILE__, __LINE__)) /** \ingroup rpmte * Create a transaction element. @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org