Fix typo in pkg_hash_fetch_best_installation_candidate.
authorMichael Hansen <michael.j.hansen@hp.com>
Wed, 14 Sep 2016 20:42:26 +0000 (13:42 -0700)
committerJo-Philipp Wich <jo@mein.io>
Wed, 15 Mar 2017 01:21:30 +0000 (02:21 +0100)
A (presumed) typo in pkg_hash_fetch_best_installation_candidate caused the
matching_pkgs vec to be sorted twice, instead of sorting matching_apkgs.
This fixes both the call and the API to match what appears to be intended.

Signed-off-by: Michael Hansen <michael.j.hansen@hp.com>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
libopkg/pkg_hash.c
libopkg/pkg_vec.c
libopkg/pkg_vec.h

index 8bb160f..611f3b9 100644 (file)
@@ -399,7 +399,7 @@ pkg_t *pkg_hash_fetch_best_installation_candidate(abstract_pkg_t * apkg,
                pkg_vec_sort(matching_pkgs,
                             pkg_name_version_and_architecture_compare);
        if (matching_apkgs->len > 1)
-               abstract_pkg_vec_sort(matching_pkgs, abstract_pkg_name_compare);
+               abstract_pkg_vec_sort(matching_apkgs, abstract_pkg_name_compare);
 
        for (i = 0; i < matching_pkgs->len; i++) {
                pkg_t *matching = matching_pkgs->pkgs[i];
index a60c5ab..ce098bc 100644 (file)
@@ -196,7 +196,7 @@ int abstract_pkg_vec_contains(abstract_pkg_vec_t * vec, abstract_pkg_t * apkg)
        return 0;
 }
 
-void abstract_pkg_vec_sort(pkg_vec_t * vec, compare_fcn_t compar)
+void abstract_pkg_vec_sort(abstract_pkg_vec_t * vec, compare_fcn_t compar)
 {
        qsort(vec->pkgs, vec->len, sizeof(pkg_t *), compar);
 }
index 876455a..48eb6a5 100644 (file)
@@ -53,7 +53,7 @@ void abstract_pkg_vec_free(abstract_pkg_vec_t * vec);
 void abstract_pkg_vec_insert(abstract_pkg_vec_t * vec, abstract_pkg_t * pkg);
 abstract_pkg_t *abstract_pkg_vec_get(abstract_pkg_vec_t * vec, int i);
 int abstract_pkg_vec_contains(abstract_pkg_vec_t * vec, abstract_pkg_t * apkg);
-void abstract_pkg_vec_sort(pkg_vec_t * vec, compare_fcn_t compar);
+void abstract_pkg_vec_sort(abstract_pkg_vec_t * vec, compare_fcn_t compar);
 
 int pkg_compare_names(const void *p1, const void *p2);
 #endif