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: 25-May-2009 00:27:47 Branch: HEAD Handle: 2009052422274601 Modified files: rpm CHANGES rpm/lib librpm.vers rpmps.c rpmps.h Log: - jbj: rpmps: fix: remove the hack-o-round, handle rpmps like other pools. Summary: Revision Changes Path 1.2995 +1 -0 rpm/CHANGES 1.70 +0 -1 rpm/lib/librpm.vers 2.35 +26 -37 rpm/lib/rpmps.c 2.28 +11 -9 rpm/lib/rpmps.h ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.2994 -r1.2995 CHANGES --- rpm/CHANGES 24 May 2009 20:50:53 -0000 1.2994 +++ rpm/CHANGES 24 May 2009 22:27:46 -0000 1.2995 @@ -1,5 +1,6 @@ 5.2b1 -> 5.3a1 + - jbj: rpmps: fix: remove the hack-o-round, handle rpmps like other pools. - jbj: yarn: convert dbiIndex to usage mutex with refcounts. - jbj: yarn: convert Package to usage mutex with refcounts. - jbj: yarn: convert Spec to usage mutex with refcounts. @@ . patch -p0 <<'@@ .' Index: rpm/lib/librpm.vers ============================================================================ $ cvs diff -u -r1.69 -r1.70 librpm.vers --- rpm/lib/librpm.vers 7 May 2009 21:45:19 -0000 1.69 +++ rpm/lib/librpm.vers 24 May 2009 22:27:47 -0000 1.70 @@ -227,7 +227,6 @@ rpmpsAppend; rpmpsCreate; _rpmps_debug; - rpmpsFree; rpmpsFreeIterator; rpmpsInitIterator; rpmpsNextIterator; @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmps.c ============================================================================ $ cvs diff -u -r2.34 -r2.35 rpmps.c --- rpm/lib/rpmps.c 6 Apr 2009 00:21:21 -0000 2.34 +++ rpm/lib/rpmps.c 24 May 2009 22:27:47 -0000 2.35 @@ -7,7 +7,6 @@ #include <rpmio.h> #include <rpmiotypes.h> /* XXX fnpyKey */ #include <rpmtypes.h> -#include <yarn.h> #define _RPMPS_INTERNAL #include "rpmps.h" @@ -20,6 +19,22 @@ /*...@unchecked@*/ int _rpmps_debug = 0; +static void rpmpsFini(void * _ps) +{ + rpmps ps = _ps; + int i; + + if (ps == NULL) return; + if (ps->probs) + for (i = 0; i < ps->numProblems; i++) { + rpmProblem p = ps->probs + i; + p->pkgNEVR = _free(p->pkgNEVR); + p->altNEVR = _free(p->altNEVR); + p->str1 = _free(p->str1); + } + ps->probs = _free(ps->probs); +} + /*...@unchecked@*/ /*...@only@*/ /*...@null@*/ rpmioPool _rpmpsPool; @@ -31,12 +46,21 @@ if (_rpmpsPool == NULL) { _rpmpsPool = rpmioNewPool("ps", sizeof(*ps), -1, _rpmps_debug, - NULL, NULL, NULL); + NULL, NULL, rpmpsFini); pool = _rpmpsPool; } return (rpmps) rpmioGetPool(pool, sizeof(*ps)); } +rpmps rpmpsCreate(void) +{ + rpmps ps = rpmpsGetPool(_rpmpsPool); + ps->numProblems = 0; + ps->numProblemsAlloced = 0; + ps->probs = NULL; + return rpmpsLink(ps, "create"); +} + int rpmpsNumProblems(rpmps ps) { int numProblems = 0; @@ -90,41 +114,6 @@ return p; } -rpmps rpmpsCreate(void) -{ -#ifdef BUGGY - rpmps ps = rpmpsGetPool(_rpmpsPool); -#else - rpmps ps = rpmpsGetPool(NULL); -#endif - return rpmpsLink(ps, "create"); -} - -rpmps rpmpsFree(rpmps ps) -{ - if (ps == NULL) return NULL; - yarnPossess(ps->_item.use); -/*...@-modfilesys@*/ -if (_rpmps_debug) -fprintf(stderr, "--> ps %p -- %ld %s at %s:%u\n", ps, yarnPeekLock(ps->_item.use), "rpmpsFree", __FILE__, __LINE__); -/*...@=modfilesys@*/ - if (yarnPeekLock(ps->_item.use) <= 1L) { - if (ps->probs) { - int i; - for (i = 0; i < ps->numProblems; i++) { - rpmProblem p = ps->probs + i; - p->pkgNEVR = _free(p->pkgNEVR); - p->altNEVR = _free(p->altNEVR); - p->str1 = _free(p->str1); - } - ps->probs = _free(ps->probs); - } - ps = (rpmps) rpmioPutPool((rpmioItem)ps); - } else - yarnTwist(ps->_item.use, BY, -1); - return NULL; -} - void rpmpsAppend(rpmps ps, rpmProblemType type, const char * pkgNEVR, fnpyKey key, const char * dn, const char * bn, @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmps.h ============================================================================ $ cvs diff -u -r2.27 -r2.28 rpmps.h --- rpm/lib/rpmps.h 27 Mar 2009 21:17:42 -0000 2.27 +++ rpm/lib/rpmps.h 24 May 2009 22:27:47 -0000 2.28 @@ -143,6 +143,17 @@ ((rpmps)rpmioLinkPoolItem((rpmioItem)(_ps), _msg, __FILE__, __LINE__)) /** + * Destroy a problem set. + * @param ps problem set + * @return NULL on last dereference + */ +/*...@null@*/ +rpmps rpmpsFree(/*...@killref@*/ /*...@only@*/ /*...@null@*/ rpmps ps) + /*...@modifies ps @*/; +#define rpmpsFree(_ps) \ + ((rpmps)rpmioFreePoolItem((rpmioItem)(_ps), __FUNCTION__, __FILE__, __LINE__)) + +/** * Return number of problems in set. * @param ps problem set * @return number of problems @@ -191,15 +202,6 @@ /*...@*/; /** - * Destroy a problem set. - * @param ps problem set - * @return NULL on last dereference - */ -/*...@null@*/ -rpmps rpmpsFree(/*...@killref@*/ /*...@only@*/ /*...@null@*/ rpmps ps) - /*...@modifies ps @*/; - -/** * Print problems to file handle. * @param fp file handle (NULL uses stderr) * @param ps problem set @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org