Add an alternative rpmds constructor to allow shared pool usage
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 11 Sep 2012 10:53:24 +0000 (13:53 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 11 Sep 2012 10:53:24 +0000 (13:53 +0300)
- rpmdsNewPool() allows specifying shared/private pool, and rpmdsNew()
  is now just a wrapper to always call it with NULL (ie private) pool.

lib/rpmds.c
lib/rpmds.h

index c07f533..7e6582a 100644 (file)
@@ -162,7 +162,7 @@ static rpmds rpmdsCreate(rpmstrPool pool,
     return rpmdsLink(ds);
 }
 
-rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags)
+rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags)
 {
     rpmTagVal tagEVR, tagF;
     rpmds ds = NULL;
@@ -174,7 +174,7 @@ rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags)
     if (headerGet(h, tagN, &names, HEADERGET_MINMEM)) {
        struct rpmtd_s evr, flags; 
 
-       ds = rpmdsCreate(NULL, tagN, Type,
+       ds = rpmdsCreate(pool, tagN, Type,
                         rpmtdCount(&names), headerGetInstance(h));
 
        ds->N = rpmtdToPool(&names, ds->pool);
@@ -203,6 +203,11 @@ exit:
     return ds;
 }
 
+rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags)
+{
+    return rpmdsNewPool(NULL, h, tagN, flags);
+}
+
 char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds)
 {
     const char * N = rpmdsN(ds);
index d096b67..d0ec292 100644 (file)
@@ -98,6 +98,7 @@ rpmds rpmdsLink(rpmds ds);
  * @return             NULL always
  */
 rpmds rpmdsFree(rpmds ds);
+
 /** \ingroup rpmds
  * Create and load a dependency set.
  * @param h            header
@@ -108,6 +109,16 @@ rpmds rpmdsFree(rpmds ds);
 rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags);
 
 /** \ingroup rpmds
+ * Create and load a dependency set.
+ * @param pool         shared string pool (or NULL for private pool)
+ * @param h            header
+ * @param tagN         type of dependency
+ * @param flags                unused
+ * @return             new dependency set
+ */
+rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags);
+
+/** \ingroup rpmds
  * Return new formatted dependency string.
  * @param dspfx                formatted dependency string prefix
  * @param ds           dependency set