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 8bb160fb88c86bf2f1cd5b0a82f6bf1d277d8e84..611f3b901f5e6bd03a9cef4e7ac376904d1dfcb2 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 a60c5ab7f8bcc0fa60f56b315d1f8d97a0fef7f9..ce098bc367456e38e437a8e4d55b1d63601cd778 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 876455a6b03aad1b4229ae85c2dd21c2e471fd93..48eb6a541a327c5069cce9c9f8a9ede644ae7202 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