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:   29-Mar-2009 20:42:22
  Branch: HEAD                             Handle: 2009032918422101

  Modified files:
    rpm                     CHANGES
    rpm/lib                 rpmds.c
    rpm/python              spec-py.c
    rpm/rpmio               librpmio.vers poptIO.c rpmhash.h rpmio.c rpmiob.c
                            rpmiotypes.h

  Log:
    - yarn: convert rpmiob to usage mutex with refcounts.

  Summary:
    Revision    Changes     Path
    1.2885      +1  -0      rpm/CHANGES
    2.142       +16 -16     rpm/lib/rpmds.c
    1.14        +3  -4      rpm/python/spec-py.c
    2.101       +0  -1      rpm/rpmio/librpmio.vers
    1.35        +4  -0      rpm/rpmio/poptIO.c
    1.10        +1  -1      rpm/rpmio/rpmhash.h
    1.176       +6  -4      rpm/rpmio/rpmio.c
    1.4         +27 -7      rpm/rpmio/rpmiob.c
    1.16        +31 -6      rpm/rpmio/rpmiotypes.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2884 -r1.2885 CHANGES
  --- rpm/CHANGES       28 Mar 2009 23:13:47 -0000      1.2884
  +++ rpm/CHANGES       29 Mar 2009 18:42:21 -0000      1.2885
  @@ -1,5 +1,6 @@
   
   5.2a3 -> 5.2a4:
  +    - jbj: yarn: convert rpmiob to usage mutex with refcounts.
       - rse: add RPM Lua function rpm.hostname()
       - jbj: fix: handle ./../foo paths correctly (#491388).
       - jbj: rpmlib: rescusitate splint annotations.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmds.c
  ============================================================================
  $ cvs diff -u -r2.141 -r2.142 rpmds.c
  --- rpm/lib/rpmds.c   27 Mar 2009 21:17:42 -0000      2.141
  +++ rpm/lib/rpmds.c   29 Mar 2009 18:42:22 -0000      2.142
  @@ -160,23 +160,23 @@
   {
       rpmds ds = _ds;
   
  -     if (ds->Count > 0) {
  -         ds->N = _free(ds->N);
  -         ds->EVR = _free(ds->EVR);
  -         ds->Flags = _free(ds->Flags);
  -         (void)headerFree(ds->h);
  -         ds->h = NULL;
  -     }
  +    if (ds->Count > 0) {
  +     ds->N = _free(ds->N);
  +     ds->EVR = _free(ds->EVR);
  +     ds->Flags = _free(ds->Flags);
  +     (void)headerFree(ds->h);
  +     ds->h = NULL;
  +    }
   
  -     ds->DNEVR = _free(ds->DNEVR);
  -     ds->ns.str = _free(ds->ns.str);
  -     memset(&ds->ns, 0, sizeof(ds->ns));
  -     ds->A = _free(ds->A);
  -     ds->Color = _free(ds->Color);
  -     ds->Refs = _free(ds->Refs);
  -     ds->Result = _free(ds->Result);
  -     ds->exclude = mireFreeAll(ds->exclude, ds->nexclude);
  -     ds->include = mireFreeAll(ds->include, ds->ninclude);
  +    ds->DNEVR = _free(ds->DNEVR);
  +    ds->ns.str = _free(ds->ns.str);
  +    memset(&ds->ns, 0, sizeof(ds->ns));
  +    ds->A = _free(ds->A);
  +    ds->Color = _free(ds->Color);
  +    ds->Refs = _free(ds->Refs);
  +    ds->Result = _free(ds->Result);
  +    ds->exclude = mireFreeAll(ds->exclude, ds->nexclude);
  +    ds->include = mireFreeAll(ds->include, ds->ninclude);
   }
   
   /*...@unchecked@*/ /*...@only@*/ /*...@null@*/
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/python/spec-py.c
  ============================================================================
  $ cvs diff -u -r1.13 -r1.14 spec-py.c
  --- rpm/python/spec-py.c      26 Mar 2009 18:07:33 -0000      1.13
  +++ rpm/python/spec-py.c      29 Mar 2009 18:42:22 -0000      1.14
  @@ -34,14 +34,13 @@
    *
    */
   
  -
   static void 
   spec_dealloc(specObject * s) 
       /*...@modifies s @*/
   {
  -        if (s->spec)
  -            s->spec = freeSpec(s->spec);
  -        PyObject_Del(s);
  +    if (s->spec)
  +     s->spec = freeSpec(s->spec);
  +    PyObject_Del(s);
   }
   
   static int
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/librpmio.vers
  ============================================================================
  $ cvs diff -u -r2.100 -r2.101 librpmio.vers
  --- rpm/rpmio/librpmio.vers   21 Mar 2009 15:25:12 -0000      2.100
  +++ rpm/rpmio/librpmio.vers   29 Mar 2009 18:42:22 -0000      2.101
  @@ -290,7 +290,6 @@
       rpmiobAppend;
       rpmiobBuf;
       rpmiobEmpty;
  -    rpmiobFree;
       rpmiobLen;
       rpmiobNew;
       rpmiobRTrim;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/poptIO.c
  ============================================================================
  $ cvs diff -u -r1.34 -r1.35 poptIO.c
  --- rpm/rpmio/poptIO.c        25 Mar 2009 19:55:35 -0000      1.34
  +++ rpm/rpmio/poptIO.c        29 Mar 2009 18:42:22 -0000      1.35
  @@ -64,6 +64,8 @@
   /*...@unchecked@*/
   extern int _rpmio_debug;
   /*...@unchecked@*/
  +extern int _rpmiob_debug;
  +/*...@unchecked@*/
   extern int _rpmsq_debug;
   /*...@unchecked@*/
   extern int _rpmzq_debug;
  @@ -401,6 +403,8 @@
        N_("Debug PGP usage"), NULL},
    { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, 
-1,
        N_("Debug rpmio I/O"), NULL},
  + { "rpmiobdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, 
&_rpmiob_debug, -1,
  +     N_("Debug rpmio I/O buffers"), NULL},
    { "rpmmgdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmmg_debug, 
-1,
        N_("Debug rpmmg magic"), NULL},
    { "rpmsqdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmsq_debug, 
-1,
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmhash.h
  ============================================================================
  $ cvs diff -u -r1.9 -r1.10 rpmhash.h
  --- rpm/rpmio/rpmhash.h       26 Mar 2009 20:09:03 -0000      1.9
  +++ rpm/rpmio/rpmhash.h       29 Mar 2009 18:42:22 -0000      1.10
  @@ -103,7 +103,7 @@
   
   /**
    * Reference a hash table instance.
  - * @param ds         hash table
  + * @param ht         hash table
    * @return           new hash table reference
    */
   /*...@unused@*/ /*...@newref@*/ /*...@null@*/
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.c
  ============================================================================
  $ cvs diff -u -r1.175 -r1.176 rpmio.c
  --- rpm/rpmio/rpmio.c 25 Mar 2009 20:26:46 -0000      1.175
  +++ rpm/rpmio/rpmio.c 29 Mar 2009 18:42:22 -0000      1.176
  @@ -3118,13 +3118,14 @@
   void rpmioClean(void)
   {
   /*...@-nestedextern@*/
  -    extern rpmioPool _digPool;
  -    extern rpmioPool _xarPool;
       extern rpmioPool _urlPool;
  -    extern rpmioPool _rpmmgPool;
  +    extern rpmioPool _xarPool;
  +    extern rpmioPool _digPool;
  +    extern rpmioPool _rpmiobPool;
   /*...@-shadow@*/
       extern rpmioPool _htPool;
   /*...@=shadow@*/
  +    extern rpmioPool _rpmmgPool;
   /*...@=nestedextern@*/
   
   #if defined(WITH_LUA)
  @@ -3141,8 +3142,9 @@
   #endif
       urlFreeCache();
   
  -    _htPool = rpmioFreePool(_htPool);
       _rpmmgPool = rpmioFreePool(_rpmmgPool);
  +    _htPool = rpmioFreePool(_htPool);
  +    _rpmiobPool = rpmioFreePool(_rpmiobPool);
       _digPool = rpmioFreePool(_digPool);
       _xarPool = rpmioFreePool(_xarPool);
       _urlPool = rpmioFreePool(_urlPool);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmiob.c
  ============================================================================
  $ cvs diff -u -r1.3 -r1.4 rpmiob.c
  --- rpm/rpmio/rpmiob.c        20 Dec 2008 00:51:46 -0000      1.3
  +++ rpm/rpmio/rpmiob.c        29 Mar 2009 18:42:22 -0000      1.4
  @@ -10,18 +10,38 @@
   /*...@unchecked@*/
   size_t _rpmiob_chunk = 1024;
   
  -rpmiob rpmiobFree(rpmiob iob)
  +/*...@unchecked@*/
  +int _rpmiob_debug;
  +
  +static void rpmiobFini(void * _iob)
  +{
  +    rpmiob iob = _iob;
  +
  +    iob->b = _free(iob->b);
  +    iob->blen = 0;
  +    iob->allocated = 0;
  +}
  +
  +/*...@unchecked@*/ /*...@only@*/ /*...@null@*/
  +rpmioPool _rpmiobPool;
  +
  +static rpmiob rpmiobGetPool(/*...@null@*/ rpmioPool pool)
  +     /*...@globals _rpmiobPool, fileSystem @*/
  +     /*...@modifies pool, _rpmiobPool, fileSystem @*/
   {
  -    if (iob != NULL) {
  -     iob->b = _free(iob->b);
  -     iob = _free(iob);
  +    rpmiob iob;
  +
  +    if (_rpmiobPool == NULL) {
  +     _rpmiobPool = rpmioNewPool("iob", sizeof(*iob), -1, _rpmiob_debug,
  +                     NULL, NULL, rpmiobFini);
  +     pool = _rpmiobPool;
       }
  -    return NULL;
  +    return (rpmiob) rpmioGetPool(pool, sizeof(*iob));
   }
   
   rpmiob rpmiobNew(size_t len)
   {
  -    rpmiob iob = xcalloc(1, sizeof(*iob));
  +    rpmiob iob = rpmiobGetPool(_rpmiobPool);
       if (len == 0)
        len = _rpmiob_chunk;
       iob->allocated = len;
  @@ -142,7 +162,7 @@
       if (rc == 0) {
        if (iobp != NULL) {
            /* XXX use rpmiobNew() if/when lazy iop->b alloc is implemented. */
  -         rpmiob iob = xcalloc(1, sizeof(*iob));
  +         rpmiob iob = rpmiobGetPool(_rpmiobPool);
            iob->b = b;
            iob->blen = blen;
            iob->allocated = blen;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmiotypes.h
  ============================================================================
  $ cvs diff -u -r1.15 -r1.16 rpmiotypes.h
  --- rpm/rpmio/rpmiotypes.h    25 Mar 2009 20:26:47 -0000      1.15
  +++ rpm/rpmio/rpmiotypes.h    29 Mar 2009 18:42:22 -0000      1.16
  @@ -214,9 +214,10 @@
   /** \ingroup rpmio
    */
   struct rpmiob_s{
  -    rpmuint8_t * b;  /*!< data octects. */
  -    size_t blen;     /*!< no. of octets used. */
  -    size_t allocated;        /*!< no. of octets allocated. */
  +    struct rpmioItem_s _item;        /*!< usage mutex and pool identifier. */
  +    rpmuint8_t * b;          /*!< data octects. */
  +    size_t blen;             /*!< no. of octets used. */
  +    size_t allocated;                /*!< no. of octets allocated. */
   };
   #endif
   
  @@ -390,13 +391,37 @@
        /*...@modifies *str @*/;
   
   /**
  - * Destroy an I/O buffer.
  + * Unreference a I/O buffer instance.
  + * @param iob                hash table
  + * @return           NULL if free'd
  + */
  +/*...@unused@*/ /*...@null@*/
  +rpmiob rpmiobUnlink (/*...@killref@*/ /*...@null@*/ rpmiob iob)
  +     /*...@modifies iob @*/;
  +#define      rpmiobUnlink(_iob)      \
  +    ((rpmiob)rpmioUnlinkPoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, 
__LINE__))
  +
  +/**
  + * Reference a I/O buffer instance.
    * @param iob                I/O buffer
  - * @return           NULL always
  + * @return           new I/O buffer reference
  + */
  +/*...@unused@*/ /*...@newref@*/ /*...@null@*/
  +rpmiob rpmiobLink (/*...@null@*/ rpmiob iob)
  +     /*...@modifies iob @*/;
  +#define      rpmiobLink(_iob)        \
  +    ((rpmiob)rpmioLinkPoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, 
__LINE__))
  +
  +/**
  + * Destroy a I/O buffer instance.
  + * @param iob                I/O buffer
  + * @return           NULL on last dereference
    */
   /*...@null@*/
  -rpmiob rpmiobFree(/*...@only@*/ /*...@null@*/ rpmiob iob)
  +rpmiob rpmiobFree( /*...@only@*/ rpmiob iob)
        /*...@modifies iob @*/;
  +#define      rpmiobFree(_iob)        \
  +    ((rpmiob)rpmioFreePoolItem((rpmioItem)(_iob), __FUNCTION__, __FILE__, 
__LINE__))
   
   /**
    * Create an I/O buffer.
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to