RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  [EMAIL PROTECTED]
  Module: rpm                              Date:   17-May-2008 15:14:46
  Branch: HEAD                             Handle: 2008051713144501

  Modified files:
    rpm                     CHANGES
    rpm/lib                 tevr.c

  Log:
    - jbj: tevr: add missing level of ht indirection, free input strings.

  Summary:
    Revision    Changes     Path
    1.2345      +1  -0      rpm/CHANGES
    2.2         +10 -10     rpm/lib/tevr.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2344 -r1.2345 CHANGES
  --- rpm/CHANGES       13 May 2008 19:42:34 -0000      1.2344
  +++ rpm/CHANGES       17 May 2008 13:14:45 -0000      1.2345
  @@ -1,5 +1,6 @@
   
   5.1.0 -> 5.2a0:
  +    - jbj: tevr: add missing level of ht indirection, free input strings.
       - jbj: fix: --triggers segfault, don't depend on he->p.ptr = NULL after
        headerGet() failed return.
       - jbj: try ":foo" == extractor, "|foo" == transformer, format extensions.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/tevr.c
  ============================================================================
  $ cvs diff -u -r2.1 -r2.2 tevr.c
  --- rpm/lib/tevr.c    16 May 2008 20:09:35 -0000      2.1
  +++ rpm/lib/tevr.c    17 May 2008 13:14:46 -0000      2.2
  @@ -49,17 +49,14 @@
   static void rpmdictAdd(rpmdict dict, const char * key)
   {
       uint64_t * val = NULL;
  -    int vallen = sizeof(*val);
  -    int notfound = htGetEntry(dict->ht, key, &val, &vallen, NULL);
  -    if (notfound) {
  +    void ** data = (void **)&val;
  +    if (htGetEntry(dict->ht, key, &data, NULL, NULL)) {
        (void) argvAdd(&dict->av, key);
  -     val = xmalloc(sizeof(*val));
  -     val[0] = 0;
  +     val = xcalloc(1, sizeof(*val));
        htAddEntry(dict->ht, dict->av[dict->ac++], val);
  -    }
  -#ifdef       NOTYET
  +    } else
  +     val = (uint64_t *)data[0];
       val[0]++;
  -#endif
   }
   
   /[EMAIL PROTECTED]@*/
  @@ -69,7 +66,8 @@
       rpmdict dict = xcalloc(1, sizeof(*dict));
       int nbuckets = 4093;
       size_t keySize = 0;
  -    int freeData = 0;
  +    int freeData = 1;
  +    /* XXX hashEqualityString uses strcmp, perhaps rpmEVRcmp instead? */
       dict->ht = htCreate(nbuckets, keySize, freeData, NULL, NULL);
       rpmdictAdd(dict, key);
       return dict;
  @@ -156,7 +154,8 @@
       else
        progname = argv[0];
   
  -    av = poptGetArgs(optCon);
  +    av = NULL;
  +    (void) argvAppend(&av, poptGetArgs(optCon));
       ac = argvCount(av);
   
       if (ac == 0 || !strcmp(*av, "-")) {
  @@ -230,6 +229,7 @@
       evr = _free(evr);
       dict = rpmdictFree(dict);
   
  +    av = argvFree(av);
       optCon = rpmioFini(optCon);
   
       return rc;
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [email protected]

Reply via email to