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: 18-Mar-2009 19:36:38 Branch: HEAD Handle: 2009031818363602 Modified files: rpm CHANGES rpm/lib rpmds.c rpmds.h rpmfi.c rpmfi.h rpm/rpmdb header.c rpm/rpmio rpmio.c rpmurl.h url.c Log: - jbj: yarn: use the pool changes where possible. Summary: Revision Changes Path 1.2835 +1 -0 rpm/CHANGES 2.131 +1 -26 rpm/lib/rpmds.c 2.77 +9 -16 rpm/lib/rpmds.h 2.138 +1 -25 rpm/lib/rpmfi.c 2.70 +4 -28 rpm/lib/rpmfi.h 1.171 +1 -1 rpm/rpmdb/header.c 1.166 +9 -9 rpm/rpmio/rpmio.c 1.37 +4 -8 rpm/rpmio/rpmurl.h 1.64 +15 -9 rpm/rpmio/url.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.2834 -r1.2835 CHANGES --- rpm/CHANGES 18 Mar 2009 16:46:59 -0000 1.2834 +++ rpm/CHANGES 18 Mar 2009 18:36:36 -0000 1.2835 @@ -1,5 +1,6 @@ 5.2a3 -> 5.2a4: + - jbj: yarn: use the pool changes where possible. - jbj: yarn: add generic Link/Unlink refcount diddlers. - jbj: yarn: add debugging, reuse counter, and zlog to rpmioPool. - jbj: yarn: trick up a __FILE__:__LINE__ from caller when failing too. @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmds.c ============================================================================ $ cvs diff -u -r2.130 -r2.131 rpmds.c --- rpm/lib/rpmds.c 17 Mar 2009 23:59:02 -0000 2.130 +++ rpm/lib/rpmds.c 18 Mar 2009 18:36:38 -0000 2.131 @@ -131,37 +131,12 @@ rpmds ds; if (_rpmdsPool == NULL) { - _rpmdsPool = rpmioNewPool("ds", sizeof(*ds), -1); + _rpmdsPool = rpmioNewPool("ds", sizeof(*ds), -1, _rpmds_debug); pool = _rpmdsPool; } return (rpmds) rpmioGetPool(pool, sizeof(*ds)); } -rpmds XrpmdsUnlink(rpmds ds, const char * msg, const char * fn, unsigned ln) -{ - if (ds == NULL) return NULL; - yarnPossess(ds->use); -/*...@-modfilesys@*/ -if (_rpmds_debug && msg != NULL) -fprintf(stderr, "--> ds %p -- %ld %s at %s:%u\n", ds, yarnPeekLock(ds->use), msg, fn, ln); -/*...@=modfilesys@*/ - yarnTwist(ds->use, BY, -1); - return NULL; -} - -rpmds XrpmdsLink(rpmds ds, const char * msg, const char * fn, unsigned ln) -{ - if (ds == NULL) return NULL; - yarnPossess(ds->use); -/*...@-modfilesys@*/ -if (_rpmds_debug && msg != NULL) -fprintf(stderr, "--> ds %p ++ %ld %s at %s:%u\n", ds, yarnPeekLock(ds->use)+1, msg, fn, ln); -/*...@=modfilesys@*/ - yarnTwist(ds->use, BY, 1); - - /*...@-refcounttrans@*/ return ds; /*...@=refcounttrans@*/ -} - /** * Return dependency set type string. * @param tagN dependency set tag @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmds.h ============================================================================ $ cvs diff -u -r2.76 -r2.77 rpmds.h --- rpm/lib/rpmds.h 17 Mar 2009 23:59:02 -0000 2.76 +++ rpm/lib/rpmds.h 18 Mar 2009 18:36:38 -0000 2.77 @@ -40,6 +40,7 @@ yarnLock use; /*!< use count -- return to pool when zero */ /*...@shared@*/ /*...@null@*/ void *pool; /*!< pool (or NULL if malloc'd) */ + /*...@observer@*/ const char * Type; /*!< Tag name. */ /*...@only@*/ /*...@null@*/ @@ -85,6 +86,10 @@ * Container for provides/requires/conflicts/obsoletes dependency set(s). */ struct rpmPRCO_s { + yarnLock use; /*!< use count -- return to pool when zero */ +/*...@shared@*/ /*...@null@*/ + void *pool; /*!< pool (or NULL if malloc'd) */ + /*...@dependent@*/ /*...@relnull@*/ rpmds * Pdsp; /*!< Provides: collector. */ /*...@dependent@*/ /*...@relnull@*/ @@ -135,15 +140,8 @@ rpmds rpmdsUnlink (/*...@killref@*/ /*...@only@*/ /*...@null@*/ rpmds ds, /*...@null@*/ const char * msg) /*...@modifies ds @*/; - -/** @todo Remove debugging entry from the ABI. */ -/*...@-exportlocal@*/ -/*...@null@*/ -rpmds XrpmdsUnlink (/*...@killref@*/ /*...@only@*/ /*...@null@*/ rpmds ds, - /*...@null@*/ const char * msg, const char * fn, unsigned ln) - /*...@modifies ds @*/; -/*...@=exportlocal@*/ -#define rpmdsUnlink(_ds, _msg) XrpmdsUnlink(_ds, _msg, __FILE__, __LINE__) +#define rpmdsUnlink(_ds, _msg) \ + ((rpmds)rpmioUnlinkPoolItem((rpmioItem)(_ds), _msg, __FILE__, __LINE__)) /** \ingroup rpmds * Reference a dependency set instance. @@ -154,13 +152,8 @@ /*...@unused@*/ /*...@newref@*/ /*...@null@*/ rpmds rpmdsLink (/*...@null@*/ rpmds ds, /*...@null@*/ const char * msg) /*...@modifies ds @*/; - -/** @todo Remove debugging entry from the ABI. */ -/*...@newref@*/ /*...@null@*/ -rpmds XrpmdsLink (/*...@null@*/ rpmds ds, /*...@null@*/ const char * msg, - const char * fn, unsigned ln) - /*...@modifies ds @*/; -#define rpmdsLink(_ds, _msg) XrpmdsLink(_ds, _msg, __FILE__, __LINE__) +#define rpmdsLink(_ds, _msg) \ + ((rpmds)rpmioLinkPoolItem((rpmioItem)(_ds), _msg, __FILE__, __LINE__)) /** \ingroup rpmds * Destroy a dependency set. @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmfi.c ============================================================================ $ cvs diff -u -r2.137 -r2.138 rpmfi.c --- rpm/lib/rpmfi.c 17 Mar 2009 23:59:02 -0000 2.137 +++ rpm/lib/rpmfi.c 18 Mar 2009 18:36:38 -0000 2.138 @@ -63,36 +63,12 @@ rpmfi fi; if (_rpmfiPool == NULL) { - _rpmfiPool = rpmioNewPool("fi", sizeof(*fi), -1); + _rpmfiPool = rpmioNewPool("fi", sizeof(*fi), -1, _rpmfi_debug); pool = _rpmfiPool; } return (rpmfi) rpmioGetPool(pool, sizeof(*fi)); } -rpmfi XrpmfiUnlink(rpmfi fi, const char * msg, const char * fn, unsigned ln) -{ - if (fi == NULL) return NULL; - yarnPossess(fi->use); -/*...@-modfilesys@*/ -if (_rpmfi_debug && msg != NULL) -fprintf(stderr, "--> fi %p -- %ld %s at %s:%u\n", fi, yarnPeekLock(fi->use), msg, fn, ln); -/*...@=modfilesys@*/ - yarnTwist(fi->use, BY, -1); - return NULL; -} - -rpmfi XrpmfiLink(rpmfi fi, const char * msg, const char * fn, unsigned ln) -{ - if (fi == NULL) return NULL; - yarnPossess(fi->use); -/*...@-modfilesys@*/ -if (_rpmfi_debug && msg != NULL) -fprintf(stderr, "--> fi %p ++ %ld %s at %s:%u\n", fi, yarnPeekLock(fi->use)+1, msg, fn, ln); -/*...@=modfilesys@*/ - yarnTwist(fi->use, BY, 1); - /*...@-refcounttrans@*/ return fi; /*...@=refcounttrans@*/ -} - int rpmfiFC(rpmfi fi) { return (fi != NULL ? fi->fc : 0); @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmfi.h ============================================================================ $ cvs diff -u -r2.69 -r2.70 rpmfi.h --- rpm/lib/rpmfi.h 17 Mar 2009 23:59:02 -0000 2.69 +++ rpm/lib/rpmfi.h 18 Mar 2009 18:36:38 -0000 2.70 @@ -260,21 +260,8 @@ rpmfi rpmfiUnlink (/*...@killref@*/ /*...@only@*/ /*...@null@*/ rpmfi fi, /*...@null@*/ const char * msg) /*...@modifies fi @*/; - -/** @todo Remove debugging entry from the ABI. - * @param fi file info set - * @param msg - * @param fn - * @param ln - * @return NULL always - */ -/*...@-exportlocal@*/ -/*...@null@*/ -rpmfi XrpmfiUnlink (/*...@killref@*/ /*...@only@*/ /*...@null@*/ rpmfi fi, - /*...@null@*/ const char * msg, const char * fn, unsigned ln) - /*...@modifies fi @*/; -/*...@=exportlocal@*/ -#define rpmfiUnlink(_fi, _msg) XrpmfiUnlink(_fi, _msg, __FILE__, __LINE__) +#define rpmfiUnlink(_fi, _msg) \ + (rpmfi) rpmioUnlinkPoolItem((rpmioItem)(_fi), _msg, __FILE__, __LINE__) /** * Reference a file info set instance. @@ -285,19 +272,8 @@ /*...@unused@*/ /*...@null@*/ rpmfi rpmfiLink (/*...@null@*/ rpmfi fi, /*...@null@*/ const char * msg) /*...@modifies fi @*/; - -/** @todo Remove debugging entry from the ABI. - * @param fi file info set - * @param msg - * @param fn - * @param ln - * @return NULL always - */ -/*...@null@*/ -rpmfi XrpmfiLink (/*...@null@*/ rpmfi fi, /*...@null@*/ const char * msg, - const char * fn, unsigned ln) - /*...@modifies fi @*/; -#define rpmfiLink(_fi, _msg) XrpmfiLink(_fi, _msg, __FILE__, __LINE__) +#define rpmfiLink(_fi, _msg) \ + (rpmfi) rpmioLinkPoolItem((rpmioItem)(_fi), _msg, __FILE__, __LINE__) /** * Return file count from file info set. @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/header.c ============================================================================ $ cvs diff -u -r1.170 -r1.171 header.c --- rpm/rpmdb/header.c 17 Mar 2009 23:59:04 -0000 1.170 +++ rpm/rpmdb/header.c 18 Mar 2009 18:36:37 -0000 1.171 @@ -101,7 +101,7 @@ Header h; if (_headerPool == NULL) { - _headerPool = rpmioNewPool(" h", sizeof(*h), -1); + _headerPool = rpmioNewPool("h", sizeof(*h), -1, _hdr_debug); pool = _headerPool; } return (Header) rpmioGetPool(pool, sizeof(*h)); @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmio.c ============================================================================ $ cvs diff -u -r1.165 -r1.166 rpmio.c --- rpm/rpmio/rpmio.c 17 Mar 2009 23:59:05 -0000 1.165 +++ rpm/rpmio/rpmio.c 18 Mar 2009 18:36:37 -0000 1.166 @@ -178,7 +178,7 @@ FD_t fd; if (_fdPool == NULL) { - _fdPool = rpmioNewPool("fd", sizeof(*fd), -1); + _fdPool = rpmioNewPool("fd", sizeof(*fd), -1, _rpmio_debug); pool = _fdPool; } return (FD_t) rpmioGetPool(pool, sizeof(*fd)); @@ -287,7 +287,7 @@ /*...@-mustmod@*/ /* FIX: cookie is modified */ /*...@null@*/ FD_t XfdLink(void * cookie, const char * msg, - const char * file, unsigned line) + const char * fn, unsigned ln) /*...@modifies *cookie @*/ { FD_t fd; @@ -295,12 +295,12 @@ assert(cookie != NULL); #else if (cookie == NULL) -DBGREFS(0, (stderr, "--> fd %p ++ %ld %s at %s:%u\n", cookie, -9L, msg, file, line)); +DBGREFS(0, (stderr, "--> fd %p ++ %ld %s at %s:%u\n", cookie, -9L, msg, fn, ln)); #endif fd = c2f(cookie); if (fd) { yarnPossess(fd->use); -DBGREFS(fd, (stderr, "--> fd %p ++ %ld %s at %s:%u %s\n", fd, yarnPeekLock(fd->use)+1, msg, file, line, fdbg(fd))); +DBGREFS(fd, (stderr, "--> fd %p ++ %ld %s at %s:%u %s\n", fd, yarnPeekLock(fd->use)+1, msg, fn, ln, fdbg(fd))); yarnTwist(fd->use, BY, 1); } return fd; @@ -311,7 +311,7 @@ /*...@-incondefs@*/ /*...@null@*/ FD_t XfdFree( /*...@killref@*/ FD_t fd, const char *msg, - const char *file, unsigned line) + const char *fn, unsigned ln) /*...@modifies fd @*/ { int i; @@ -320,12 +320,12 @@ assert(fd != NULL); #else if (fd == NULL) -DBGREFS(0, (stderr, "--> fd %p -- %ld %s at %s:%u\n", fd, -9L, msg, file, line)); +DBGREFS(0, (stderr, "--> fd %p -- %ld %s at %s:%u\n", fd, -9L, msg, fn, ln)); #endif FDSANE(fd); if (fd) { yarnPossess(fd->use); -DBGREFS(fd, (stderr, "--> fd %p -- %ld %s at %s:%u %s\n", fd, yarnPeekLock(fd->use), msg, file, line, fdbg(fd))); +DBGREFS(fd, (stderr, "--> fd %p -- %ld %s at %s:%u %s\n", fd, yarnPeekLock(fd->use), msg, fn, ln, fdbg(fd))); if (yarnPeekLock(fd->use) == 1L) { fd->opath = _free(fd->opath); fd->stats = _free(fd->stats); @@ -357,7 +357,7 @@ /*...@-incondefs@*/ /*...@null@*/ -FD_t XfdNew(const char * msg, const char * file, unsigned line) +FD_t XfdNew(const char * msg, const char * fn, unsigned line) { FD_t fd = fdGetPool(_fdPool); if (fd == NULL) /* XXX xmalloc never returns NULL */ @@ -395,7 +395,7 @@ fd->ftpFileDoneNeeded = 0; fd->fd_cpioPos = 0; - return XfdLink(fd, msg, file, line); + return XfdLink(fd, msg, fn, line); } /*...@=incondefs@*/ @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmurl.h ============================================================================ $ cvs diff -u -r1.36 -r1.37 rpmurl.h --- rpm/rpmio/rpmurl.h 17 Mar 2009 23:59:05 -0000 1.36 +++ rpm/rpmio/rpmurl.h 18 Mar 2009 18:36:37 -0000 1.37 @@ -155,7 +155,7 @@ /** @todo Remove debugging entry from the ABI. */ /*...@null@*/ -urlinfo XurlNew(const char * msg, const char * file, unsigned line) /*...@*/; +urlinfo XurlNew(const char * msg, const char * fn, unsigned ln) /*...@*/; #define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__) /** @@ -167,12 +167,8 @@ /*...@unused@*/ /*...@newref@*/ urlinfo urlLink(/*...@returned@*/ urlinfo u, const char * msg) /*...@modifies u @*/; - -/** @todo Remove debugging entry from the ABI. */ -/*...@newref@*/ -urlinfo XurlLink(/*...@returned@*/ urlinfo u, const char * msg, const char * file, unsigned line) - /*...@modifies u @*/; -#define urlLink(_u, _msg) XurlLink(_u, _msg, __FILE__, __LINE__) +#define urlLink(_u, _msg) \ + (urlinfo) rpmioLinkPoolItem((rpmioItem)(_u), _msg, __FILE__, __LINE__) /** * Dereference a URL control structure instance. @@ -188,7 +184,7 @@ /** @todo Remove debugging entry from the ABI. */ /*...@null@*/ urlinfo XurlFree( /*...@killref@*/ urlinfo u, const char * msg, - const char * file, unsigned line) + const char * fn, unsigned ln) /*...@globals fileSystem, internalState @*/ /*...@modifies u, fileSystem, internalState @*/; #define urlFree(_u, _msg) XurlFree(_u, _msg, __FILE__, __LINE__) @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/url.c ============================================================================ $ cvs diff -u -r1.63 -r1.64 url.c --- rpm/rpmio/url.c 17 Mar 2009 23:59:05 -0000 1.63 +++ rpm/rpmio/url.c 18 Mar 2009 18:36:37 -0000 1.64 @@ -78,24 +78,26 @@ urlinfo u; if (_urlPool == NULL) { - _urlPool = rpmioNewPool(" u", sizeof(*u), -1); + _urlPool = rpmioNewPool(" u", sizeof(*u), -1, _url_debug); pool = _urlPool; } return (urlinfo) rpmioGetPool(pool, sizeof(*u)); } -urlinfo XurlLink(urlinfo u, const char *msg, const char *file, unsigned line) +#ifdef DYING +urlinfo XurlLink(urlinfo u, const char *msg, const char *fn, unsigned ln) { URLSANE(u); yarnPossess(u->use); /*...@-modfilesys@*/ -URLDBGREFS(0, (stderr, "--> url %p ++ %ld %s at %s:%u\n", u, yarnPeekLock(u->use)+1, msg, file, line)); +URLDBGREFS(0, (stderr, "--> url %p ++ %ld %s at %s:%u\n", u, yarnPeekLock(u->use)+1, msg, fn, ln)); /*...@=modfilesys@*/ yarnTwist(u->use, BY, 1); /*...@-refcounttrans@*/ return u; /*...@=refcounttrans@*/ } +#endif -urlinfo XurlNew(const char *msg, const char *file, unsigned line) +urlinfo XurlNew(const char *msg, const char *fn, unsigned ln) { urlinfo u = urlGetPool(_urlPool); if (u == NULL) /* XXX can't happen */ @@ -120,16 +122,20 @@ u->allow = RPMURL_SERVER_HASRANGE; u->httpVersion = 0; u->magic = URLMAGIC; - return XurlLink(u, msg, file, line); +#ifdef DYING + return XurlLink(u, msg, fn, ln); +#else + return (urlinfo) rpmioLinkPoolItem((rpmioItem)u, msg, fn, ln); +#endif } -urlinfo XurlFree(urlinfo u, const char *msg, const char *file, unsigned line) +urlinfo XurlFree(urlinfo u, const char *msg, const char *fn, unsigned ln) { int xx; URLSANE(u); yarnPossess(u->use); -URLDBGREFS(0, (stderr, "--> url %p -- %ld %s at %s:%u\n", u, yarnPeekLock(u->use), msg, file, line)); +URLDBGREFS(0, (stderr, "--> url %p -- %ld %s at %s:%u\n", u, yarnPeekLock(u->use), msg, fn, ln)); if (yarnPeekLock(u->use) > 1) { yarnTwist(u->use, BY, -1); /*...@-refcounttrans -retal...@*/ return u; /*...@=refcounttrans =retal...@*/ @@ -147,7 +153,7 @@ #endif /*...@-usereleased@*/ - u->ctrl = XfdFree(u->ctrl, "persist ctrl (urlFree)", file, line); + u->ctrl = XfdFree(u->ctrl, "persist ctrl (urlFree)", fn, ln); if (u->ctrl) fprintf(stderr, _("warning: u %p ctrl %p nrefs != 0 (%s %s)\n"), u, u->ctrl, (u->host ? u->host : ""), @@ -167,7 +173,7 @@ #endif /*...@-usereleased@*/ - u->data = XfdFree(u->data, "persist data (urlFree)", file, line); + u->data = XfdFree(u->data, "persist data (urlFree)", fn, ln); if (u->data) fprintf(stderr, _("warning: u %p data %p nrefs != 0 (%s %s)\n"), u, u->data, (u->host ? u->host : ""), @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org