From 2cec79cb14f343d822bb8098b022fe4344261c7f Mon Sep 17 00:00:00 2001 From: ticktock35 Date: Wed, 17 Dec 2008 00:27:16 +0000 Subject: [PATCH] only add pkg_vec_sort when needed git-svn-id: http://opkg.googlecode.com/svn/trunk@184 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- libopkg/opkg_cmd.c | 5 ++--- libopkg/pkg_hash.c | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c index af6c4b7..fae3085 100644 --- a/libopkg/opkg_cmd.c +++ b/libopkg/opkg_cmd.c @@ -711,6 +711,7 @@ static int opkg_list_cmd(opkg_conf_t *conf, int argc, char **argv) } available = pkg_vec_alloc(); pkg_hash_fetch_available(&conf->pkg_hash, available); + pkg_vec_sort(available, pkg_compare_names); for (i=0; i < available->len; i++) { pkg = available->pkgs[i]; /* if we have package name or pattern and pkg does not match, then skip it */ @@ -1439,6 +1440,7 @@ static int opkg_search_cmd(opkg_conf_t *conf, int argc, char **argv) installed = pkg_vec_alloc(); pkg_hash_fetch_all_installed(&conf->pkg_hash, installed); + pkg_vec_sort(installed, pkg_compare_names); for (i=0; i < installed->len; i++) { pkg = installed->pkgs[i]; @@ -1458,9 +1460,6 @@ static int opkg_search_cmd(opkg_conf_t *conf, int argc, char **argv) pkg_free_installed_files(pkg); } - /* XXX: CLEANUP: It's not obvious from the name of - pkg_hash_fetch_all_installed that we need to call - pkg_vec_free to avoid a memory leak. */ pkg_vec_free(installed); return 0; diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c index ed8006d..35f65a3 100644 --- a/libopkg/pkg_hash.c +++ b/libopkg/pkg_hash.c @@ -477,7 +477,6 @@ static void pkg_hash_fetch_available_helper(const char *pkg_name, void *entry, v void pkg_hash_fetch_available(hash_table_t *hash, pkg_vec_t *all) { hash_table_foreach(hash, pkg_hash_fetch_available_helper, all); - //qsort(all->pkgs, all->len, sizeof(pkg_t *), pkg_compare_names); } static void pkg_hash_fetch_all_installed_helper(const char *pkg_name, void *entry, void *data) @@ -498,7 +497,6 @@ static void pkg_hash_fetch_all_installed_helper(const char *pkg_name, void *entr void pkg_hash_fetch_all_installed(hash_table_t *hash, pkg_vec_t *all) { hash_table_foreach(hash, pkg_hash_fetch_all_installed_helper, all); - //qsort(all->pkgs, all->len, sizeof(void*), pkg_compare_names); } static void pkg_hash_dump_helper(const char *pkg_name, void *entry, void *data) -- 2.30.2