poldek: poldek/pkgdir/pkgdir_dirindex.c - bugfixes

mis mis at pld-linux.org
Mon Aug 21 13:19:50 CEST 2006


Author: mis                          Date: Mon Aug 21 11:19:50 2006 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- bugfixes

---- Files affected:
poldek/poldek/pkgdir:
   pkgdir_dirindex.c (1.3 -> 1.4) 

---- Diffs:

================================================================
Index: poldek/poldek/pkgdir/pkgdir_dirindex.c
diff -u poldek/poldek/pkgdir/pkgdir_dirindex.c:1.3 poldek/poldek/pkgdir/pkgdir_dirindex.c:1.4
--- poldek/poldek/pkgdir/pkgdir_dirindex.c:1.3	Sun Aug 20 23:13:20 2006
+++ poldek/poldek/pkgdir/pkgdir_dirindex.c	Mon Aug 21 13:19:45 2006
@@ -370,7 +370,7 @@
         id = na->na_malloc(na, klen);
         memcpy(id, key + 2, klen); /* key + 2 => skipping _KEY_PKGID */
         
-        n_hash_insert(keymap, val, id);
+        n_hash_replace(keymap, val, id);
 
         if (vlen < vlen_max)   /* to avoid needless tndb_it_rget()'s reallocs */
             vlen = vlen_max;
@@ -407,7 +407,6 @@
     int             i;
     tn_alloc        *na;
     tn_hash         *idmap, *keymap;
-    tn_array        *reqdirs;
     struct pkgdir_dirindex *dirindex = NULL;
 
     
@@ -450,18 +449,21 @@
         id = n_hash_get(keymap, &key[2]);
 
         if (id)
-            n_hash_insert(idmap, id, pkg_link(pkg));
+            n_hash_replace(idmap, id, pkg_link(pkg));
 
         key[0] = '_';
         key[1] = KEY_REQDIR;
 
         tl = tl_save = get_req_directories(db, key, klen + 2,
                                            val, sizeof(val), &n);
-        if (tl == NULL || n == 0)
+        if (tl == NULL || n == 0) {
+            if (tl)
+                n_str_tokl_free(tl);
             continue;
+        }
         
         if (!pkg->reqs)
-            pkg->reqs = capreq_arr_new(n_array_size(reqdirs));
+            pkg->reqs = capreq_arr_new(n);
         
         while (*tl) {
             const char *dir = *tl;
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/poldek/poldek/pkgdir/pkgdir_dirindex.c?r1=1.3&r2=1.4&f=u



More information about the pld-cvs-commit mailing list