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:   24-Mar-2009 16:18:01
  Branch: rpm-5_1                          Handle: 2009032415180001

  Modified files:           (Branch: rpm-5_1)
    rpm                     CHANGES
    rpm/rpmdb               header.c librpmdb.vers rpmtag.h

  Log:
    - yarn: wire up headerScrub, eliminate header{Link,Unlink}.

  Summary:
    Revision    Changes     Path
    1.2288.2.234+1  -0      rpm/CHANGES
    1.153.2.11  +34 -62     rpm/rpmdb/header.c
    1.43.2.10   +0  -1      rpm/rpmdb/librpmdb.vers
    1.44.2.4    +8  -0      rpm/rpmdb/rpmtag.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2288.2.233 -r1.2288.2.234 CHANGES
  --- rpm/CHANGES       23 Mar 2009 15:29:33 -0000      1.2288.2.233
  +++ rpm/CHANGES       24 Mar 2009 15:18:00 -0000      1.2288.2.234
  @@ -1,4 +1,5 @@
   5.1.7 -> 5.1.8:
  +    - jbj: yarn: wire up headerScrub, eliminate header{Link,Unlink}.
       - jbj: make misc identical to HEAD (hmm @WITH_PCRE_LDFLAGS@ is AWOL)
       - devzero2000: add mkdtemp portability function to -lrpmmisc
       - jbj: yarn: wire up rpmteFini, eliminate rpmteFree.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/header.c
  ============================================================================
  $ cvs diff -u -r1.153.2.10 -r1.153.2.11 header.c
  --- rpm/rpmdb/header.c        20 Mar 2009 19:13:23 -0000      1.153.2.10
  +++ rpm/rpmdb/header.c        24 Mar 2009 15:18:01 -0000      1.153.2.11
  @@ -90,23 +90,6 @@
   rpmop _hdr_getops = &hdr_getops;
   /*...@=compmempass@*/
   
  -
  -/*...@unchecked@*/ /*...@null@*/
  -rpmioPool _headerPool;
  -
  -static Header headerGetPool(/*...@null@*/ rpmioPool pool)
  -     /*...@modifies pool @*/
  -{
  -    Header h;
  -
  -    if (_headerPool == NULL) {
  -     _headerPool = rpmioNewPool("h", sizeof(*h), -1, _hdr_debug,
  -                     NULL, NULL, NULL);
  -     pool = _headerPool;
  -    }
  -    return (Header) rpmioGetPool(pool, sizeof(*h));
  -}
  -
   void * headerGetStats(Header h, int opx)
   {
       rpmop op = NULL;
  @@ -118,54 +101,16 @@
       return op;
   }
   
  -Header headerLink(Header h)
  -{
  -/*...@-nullret@*/
  -    if (h == NULL) return NULL;
  -/*...@=nullret@*/
  -
  -    yarnPossess(h->_item.use);
  -/*...@-modfilesys@*/
  -if (_hdr_debug)
  -fprintf(stderr, "--> h  %p ++ %ld at %s:%u\n", h, 
yarnPeekLock(h->_item.use)+1, __FILE__, __LINE__);
  -/*...@=modfilesys@*/
  -    yarnTwist(h->_item.use, BY, 1);
  -
  -    /*...@-refcounttrans @*/
  -    return h;
  -    /*...@=refcounttrans @*/
  -}
  -
  -Header headerUnlink(Header h)
  -{
  -    if (h == NULL) return NULL;
  -    yarnPossess(h->_item.use);
  -/*...@-modfilesys@*/
  -if (_hdr_debug)
  -fprintf(stderr, "--> h  %p -- %ld at %s:%u\n", h, 
yarnPeekLock(h->_item.use), __FILE__, __LINE__);
  -/*...@=modfilesys@*/
  -    yarnTwist(h->_item.use, BY, -1);
  -    return NULL;
  -}
  -
  -Header headerFree(Header h)
  +static void headerScrub(void * _h)   /* XXX headerFini already in use */
  +     /*...@modifies *_h @*/
   {
  +    Header h = _h;
   
  -    if (h == NULL)
  -     return NULL;
  -
  -    yarnPossess(h->_item.use);
  -/*...@-modfilesys@*/
  -if (_hdr_debug)
  -fprintf(stderr, "--> h  %p -- %ld at %s:%u\n", h, 
yarnPeekLock(h->_item.use), __FILE__, __LINE__);
  -/*...@=modfilesys@*/
  -    if (yarnPeekLock(h->_item.use) <= 1L) {
        if (h->index != NULL) {
            indexEntry entry = h->index;
            size_t i;
            for (i = 0; i < h->indexUsed; i++, entry++) {
  -             if ((h->flags & HEADERFLAG_ALLOCATED) && ENTRY_IS_REGION(entry))
  -             {
  +         if ((h->flags & HEADERFLAG_ALLOCATED) && ENTRY_IS_REGION(entry)) {
                    if (entry->length > 0) {
                        uint32_t * ei = entry->data;
                        if ((ei - 2) == h->blob)
  @@ -191,11 +136,38 @@
                (void) rpmswAdd(_hdr_getops, headerGetStats(h, 19));
        }
   /*...@=nullstate@*/
  -     h = (Header) rpmioPutPool((rpmioItem)h);
  -    } else
  -     yarnTwist(h->_item.use, BY, -1);
  +}
  +
  +#ifndef      BUGGY
  +Header headerFree(Header h)
  +{
  +    /* XXX There's a h = headerFree(h) somewhere that depends on
  +     * a NULL being returned from headerFree(). Wire up a NULL
  +     * return from rpmioFreePoolItem() in headerFree() for now.
  +     * Note: the code that depends on headerFree() returning NULL
  +     * is on some lazy deallocation teardown path while trying to exit from
  +     * rpm -qavv that is dereferencing a Header more often than necessary.
  +     */
  +    (void) rpmioFreePoolItem((rpmioItem)h, __FUNCTION__, __FILE__, __LINE__);
       return NULL;
   }
  +#endif
  +
  +/*...@unchecked@*/ /*...@null@*/
  +rpmioPool _headerPool;
  +
  +static Header headerGetPool(/*...@null@*/ rpmioPool pool)
  +     /*...@modifies pool @*/
  +{
  +    Header h;
  +
  +    if (_headerPool == NULL) {
  +     _headerPool = rpmioNewPool("h", sizeof(*h), -1, _hdr_debug,
  +                     NULL, NULL, headerScrub);
  +     pool = _headerPool;
  +    }
  +    return (Header) rpmioGetPool(pool, sizeof(*h));
  +}
   
   Header headerNew(void)
   {
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/librpmdb.vers
  ============================================================================
  $ cvs diff -u -r1.43.2.9 -r1.43.2.10 librpmdb.vers
  --- rpm/rpmdb/librpmdb.vers   20 Mar 2009 14:47:42 -0000      1.43.2.9
  +++ rpm/rpmdb/librpmdb.vers   24 Mar 2009 15:18:01 -0000      1.43.2.10
  @@ -59,7 +59,6 @@
       headerSetStatbuf;
       headerInit;
       headerIsEntry;
  -    headerLink;
       headerLoad;
       headerMacrosLoad;
       headerMacrosUnload;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmtag.h
  ============================================================================
  $ cvs diff -u -r1.44.2.3 -r1.44.2.4 rpmtag.h
  --- rpm/rpmdb/rpmtag.h        11 Jan 2009 17:23:21 -0000      1.44.2.3
  +++ rpm/rpmdb/rpmtag.h        24 Mar 2009 15:18:01 -0000      1.44.2.4
  @@ -811,6 +811,8 @@
    */
   Header headerLink(Header h)
        /*...@modifies h @*/;
  +#define headerLink(_h)        \
  +    ((Header)rpmioLinkPoolItem((rpmioItem)(_h), __FUNCTION__, __FILE__, 
__LINE__))
   
   /** \ingroup header
    * Dereference a header instance.
  @@ -820,6 +822,8 @@
   /*...@null@*/
   Header headerUnlink(/*...@killref@*/ /*...@null@*/ Header h)
        /*...@modifies h @*/;
  +#define headerUnlink(_h)        \
  +    ((Header)rpmioUnlinkPoolItem((rpmioItem)(_h), __FUNCTION__, __FILE__, 
__LINE__))
   
   /** \ingroup header
    * Dereference a header instance.
  @@ -829,6 +833,10 @@
   /*...@null@*/
   Header headerFree(/*...@killref@*/ /*...@null@*/ Header h)
        /*...@modifies h @*/;
  +#ifdef       NOTYET  /* XXX h = headerFree(h) NULL return needs to be 
found/fixed. */
  +#define headerFree(_h)        \
  +    ((Header)rpmioFreePoolItem((rpmioItem)(_h), __FUNCTION__, __FILE__, 
__LINE__))
  +#endif
   
   /** \ingroup header
    * Create new (empty) header instance.
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to