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

  Server: rpm5.org                         Name:   Per Øyvind Karlsen
  Root:   /v/rpm/cvs                       Email:  pkarl...@rpm5.org
  Module: rpm                              Date:   13-May-2009 14:24:32
  Branch: HEAD                             Handle: 2009051312243200

  Modified files:
    rpm/lib                 depends.c rpmrc.c

  Log:
    * cpuinfoP in unsatisfiedDepend() didn't actually get loaded before 
rpmCpuinfo(), so we need to load it there first (with same memory loss as 
before :/)
    * reuse cpuinfoP in rpmShowRC() rather than loading it again

  Summary:
    Revision    Changes     Path
    1.443       +1  -1      rpm/lib/depends.c
    2.284       +13 -8      rpm/lib/rpmrc.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/lib/depends.c
  ============================================================================
  $ cvs diff -u -r1.442 -r1.443 depends.c
  --- rpm/lib/depends.c 12 May 2009 21:16:45 -0000      1.442
  +++ rpm/lib/depends.c 13 May 2009 12:24:32 -0000      1.443
  @@ -1336,7 +1336,7 @@
       if (NSType == RPMNS_TYPE_CPUINFO) {
        static int oneshot = -1;
   
  -     if (oneshot)
  +     if (oneshot && cpuinfoP == NULL)
            oneshot = rpmdsCpuinfo(&cpuinfoP, NULL);
        if (cpuinfoP == NULL)
            goto unsatisfied;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmrc.c
  ============================================================================
  $ cvs diff -u -r2.283 -r2.284 rpmrc.c
  --- rpm/lib/rpmrc.c   12 May 2009 21:16:45 -0000      2.283
  +++ rpm/lib/rpmrc.c   13 May 2009 12:24:32 -0000      2.284
  @@ -45,6 +45,9 @@
   /*...@unchecked@*/
   int nplatpat = 0;
   
  +extern rpmds cpuinfoP;
  +
  +
   
   /** \ingroup rpmrc
    * Build and install arch/os table identifiers.
  @@ -522,7 +525,6 @@
       miRE mi_re = NULL;
       int mi_nre = 0, xx, i;
       CVOG_t cvog = NULL;
  -    extern rpmds cpuinfoP;
       struct stat st;
       char *yaml;
       rpmsyck_node *tmp, node;
  @@ -539,6 +541,7 @@
       Fread(yaml, 1, st.st_size, fd);
       Fclose(fd);
   
  +    xx = rpmdsCpuinfo(&cpuinfoP, NULL);
       cpuinfoYaml = rpmSyckLoad(yaml);
       yaml = _free(yaml);
       htGetEntry(cpuinfoYaml->firstNode->value.map, "cpuinfo", &tmp, NULL, 
NULL);
  @@ -1229,8 +1232,9 @@
        ds = NULL;
        fprintf(fp, "\n");
   
  -     xx = rpmdsCpuinfo(&ds, NULL);
  -     if (ds != NULL) {
  +     if(cpuinfoP == NULL)
  +         xx = rpmdsCpuinfo(&cpuinfoP, NULL);
  +     if (cpuinfoP != NULL) {
   #if defined(WITH_CPUINFO)
            const char * fn = "libcpuinfo";
   #else
  @@ -1238,14 +1242,15 @@
   #endif
            fprintf(fp,
                _("Features provided by current cpuinfo (from %s):\n"), fn);
  -         ds = rpmdsInit(ds);
  -         while (rpmdsNext(ds) >= 0) {
  -             const char * DNEVR = rpmdsDNEVR(ds);
  +         cpuinfoP = rpmdsInit(cpuinfoP);
  +         while (rpmdsNext(cpuinfoP) >= 0) {
  +             const char * DNEVR = rpmdsDNEVR(cpuinfoP);
                if (DNEVR != NULL)
                    fprintf(fp, "    %s\n", DNEVR+2);
            }
  -         (void)rpmdsFree(ds);
  -         ds = NULL;
  +         (void)rpmdsFree(cpuinfoP);
  +         cpuinfoP = NULL;
  +
            fprintf(fp, "\n");
        }
       }
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to