From: Michael Hansen Date: Wed, 14 Sep 2016 20:42:26 +0000 (-0700) Subject: Fix typo in pkg_hash_fetch_best_installation_candidate. X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=816d3304f7e6ff4fd6e4e6bceb0e9bbefc67032f;p=project%2Fopkg-lede.git Fix typo in pkg_hash_fetch_best_installation_candidate. 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 Signed-off-by: Alejandro del Castillo --- diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c index 8bb160f..611f3b9 100644 --- a/libopkg/pkg_hash.c +++ b/libopkg/pkg_hash.c @@ -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]; diff --git a/libopkg/pkg_vec.c b/libopkg/pkg_vec.c index a60c5ab..ce098bc 100644 --- a/libopkg/pkg_vec.c +++ b/libopkg/pkg_vec.c @@ -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); } diff --git a/libopkg/pkg_vec.h b/libopkg/pkg_vec.h index 876455a..48eb6a5 100644 --- a/libopkg/pkg_vec.h +++ b/libopkg/pkg_vec.h @@ -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