Fix package counter in mergerepo
authorTomas Mlcoch <tmlcoch@redhat.com>
Thu, 12 Apr 2012 07:57:32 +0000 (09:57 +0200)
committerTomas Mlcoch <tmlcoch@redhat.com>
Thu, 12 Apr 2012 07:57:32 +0000 (09:57 +0200)
src/mergerepo_c.c

index c65e73f..d50bccd 100644 (file)
@@ -312,7 +312,8 @@ long merge_repos(GHashTable *merged, struct CmdOptions *cmd_options) {
 
         GHashTableIter iter;
         gpointer key, value;
-        guint original_size, used;
+        guint original_size;
+        long repo_loaded_packages = 0;
 
         original_size = g_hash_table_size(tmp_hashtable);
 
@@ -322,17 +323,16 @@ long merge_repos(GHashTable *merged, struct CmdOptions *cmd_options) {
             if (add_package(pkg, repopath, merged, cmd_options)) {
                 // Package was added - remove only record from hashtable
                 g_hash_table_iter_steal(&iter);
-                loaded_packages++;
+                repo_loaded_packages++;
             } /* else {
                 // Package was not added - remove record and data
                 g_hash_table_iter_remove(&iter);
             } */
         }
 
-        used = original_size - g_hash_table_size(tmp_hashtable);
-        loaded_packages += used;
+        loaded_packages += repo_loaded_packages;
         destroy_metadata_hashtable(tmp_hashtable);
-        g_debug("Repo: %s (Loaded: %ld Used: %ld)", repopath, (unsigned long) original_size, (unsigned long) used);
+        g_debug("Repo: %s (Loaded: %ld Used: %ld)", repopath, (unsigned long) original_size, repo_loaded_packages);
     }
 
     return loaded_packages;