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 22:02:43
  Branch: HEAD                             Handle: 2009031821024201

  Modified files:
    rpm                     CHANGES
    rpm/lib                 poptALL.c rpmte.c rpmte.h

  Log:
    - yarn: convert rpmte to a usage mutex (no refcounts).

  Summary:
    Revision    Changes     Path
    1.2837      +1  -0      rpm/CHANGES
    2.108       +3  -0      rpm/lib/poptALL.c
    2.91        +18 -4      rpm/lib/rpmte.c
    2.58        +4  -0      rpm/lib/rpmte.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2836 -r1.2837 CHANGES
  --- rpm/CHANGES       18 Mar 2009 19:59:50 -0000      1.2836
  +++ rpm/CHANGES       18 Mar 2009 21:02:42 -0000      1.2837
  @@ -1,5 +1,6 @@
   
   5.2a3 -> 5.2a4:
  +    - jbj: yarn: convert rpmte to a usage mutex (no refcounts).
       - jbj: yarn: convert rpmgi refcount to usage mutex.
       - jbj: yarn: use the pool changes where possible.
       - jbj: yarn: add generic Link/Unlink refcount diddlers.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/poptALL.c
  ============================================================================
  $ cvs diff -u -r2.107 -r2.108 poptALL.c
  --- rpm/lib/poptALL.c 18 Mar 2009 19:59:50 -0000      2.107
  +++ rpm/lib/poptALL.c 18 Mar 2009 21:02:43 -0000      2.108
  @@ -118,6 +118,8 @@
   
   /*...@unchecked@*/
   extern int _rpmte_debug;
  +/*...@unchecked@*/
  +extern rpmioPool _rpmtePool;
   
   /*...@unchecked@*/
   extern int _rpmts_debug;
  @@ -455,6 +457,7 @@
       extern rpmioPool _headerPool;
   
       _rpmgiPool = rpmioFreePool(_rpmgiPool);
  +    _rpmtePool = rpmioFreePool(_rpmtePool);
   
       _rpmdsPool = rpmioFreePool(_rpmdsPool);
       _rpmfiPool = rpmioFreePool(_rpmfiPool);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmte.c
  ============================================================================
  $ cvs diff -u -r2.90 -r2.91 rpmte.c
  --- rpm/lib/rpmte.c   29 Dec 2008 22:42:25 -0000      2.90
  +++ rpm/lib/rpmte.c   18 Mar 2009 21:02:43 -0000      2.91
  @@ -26,6 +26,21 @@
   /*...@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);
  +     pool = _rpmtePool;
  +    }
  +    return (rpmte) rpmioGetPool(pool, sizeof(*te));
  +}
  +
   void rpmteCleanDS(rpmte te)
   {
       te->PRCO = rpmdsFreePRCO(te->PRCO);
  @@ -77,7 +92,6 @@
   
       p->h = headerFree(p->h);
   
  -    memset(p, 0, sizeof(*p));        /* XXX trash and burn */
       /*...@-nullstate@*/ /* FIX: p->{NEVR,name} annotations */
       return;
       /*...@=nullstate@*/
  @@ -207,9 +221,9 @@
   rpmte rpmteFree(rpmte te)
   {
       if (te != NULL) {
  +     yarnPossess(te->use); /* XXX no refcounts, rpioPutPool expects locked. 
*/
        delTE(te);
  -     memset(te, 0, sizeof(*te));     /* XXX trash and burn */
  -     te = _free(te);
  +     te = (rpmte)rpmioPutPool((rpmioItem)te);
       }
       return NULL;
   }
  @@ -222,7 +236,7 @@
                alKey pkgKey)
   {
       HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
  -    rpmte p = xcalloc(1, sizeof(*p));
  +    rpmte p = rpmteGetPool(_rpmtePool);
       int xx;
   
       p->type = type;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmte.h
  ============================================================================
  $ cvs diff -u -r2.57 -r2.58 rpmte.h
  --- rpm/lib/rpmte.h   29 Dec 2008 22:42:25 -0000      2.57
  +++ rpm/lib/rpmte.h   18 Mar 2009 21:02:43 -0000      2.58
  @@ -89,6 +89,10 @@
    * A single package instance to be installed/removed atomically.
    */
   struct rpmte_s {
  +    yarnLock use;            /*!< use count -- return to pool when zero */
  +/*...@shared@*/ /*...@null@*/
  +    void *pool;                      /*!< pool (or NULL if malloc'd) */
  +
       rpmElementType type;     /*!< Package disposition (installed/removed). */
   
   /*...@refcounted@*/ /*...@relnull@*/
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to