From f8fdce6cb0da4d832ffa730e0dacb5544c1f8154 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Tue, 25 Jan 2011 11:49:34 +1000 Subject: Read pkgcache into hash Read the package information for sync/local databases into a pmpkghash_t structure. Provide a alpm_db_get_pkgcache_list() method that returns the list from the hash object. Most usages of alpm_db_get_pkgcache are converted to this at this stage for ease of implementation. Review whether these are better accessing the hash table directly at a later stage. Signed-off-by: Allan McRae --- src/pacman/deptest.c | 2 +- src/pacman/query.c | 6 +++--- src/pacman/sync.c | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/pacman') diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c index 8895b487..0d265c70 100644 --- a/src/pacman/deptest.c +++ b/src/pacman/deptest.c @@ -41,7 +41,7 @@ int pacman_deptest(alpm_list_t *targets) for(i = targets; i; i = alpm_list_next(i)) { char *target = alpm_list_getdata(i); - if(!alpm_find_satisfier(alpm_db_get_pkgcache(localdb), target)) { + if(!alpm_find_satisfier(alpm_db_get_pkgcache_list(localdb), target)) { deps = alpm_list_add(deps, target); } } diff --git a/src/pacman/query.c b/src/pacman/query.c index c79133d1..734875be 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -170,7 +170,7 @@ static int query_fileowner(alpm_list_t *targets) } free(dname); - for(i = alpm_db_get_pkgcache(db_local); i && !found; i = alpm_list_next(i)) { + for(i = alpm_db_get_pkgcache_list(db_local); i && !found; i = alpm_list_next(i)) { alpm_list_t *j; pmpkg_t *info = alpm_list_getdata(i); @@ -228,7 +228,7 @@ static int query_search(alpm_list_t *targets) searchlist = alpm_db_search(db_local, targets); freelist = 1; } else { - searchlist = alpm_db_get_pkgcache(db_local); + searchlist = alpm_db_get_pkgcache_list(db_local); freelist = 0; } if(searchlist == NULL) { @@ -511,7 +511,7 @@ int pacman_query(alpm_list_t *targets) return(1); } - for(i = alpm_db_get_pkgcache(db_local); i; i = alpm_list_next(i)) { + for(i = alpm_db_get_pkgcache_list(db_local); i; i = alpm_list_next(i)) { pkg = alpm_list_getdata(i); if(filter(pkg)) { int value = display(pkg); diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 26f6f824..7af1667a 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -328,7 +328,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets) ret = alpm_db_search(db, targets); freelist = 1; } else { - ret = alpm_db_get_pkgcache(db); + ret = alpm_db_get_pkgcache_list(db); freelist = 0; } if(ret == NULL) { @@ -469,7 +469,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) return(1); } - for(k = alpm_db_get_pkgcache(db); k; k = alpm_list_next(k)) { + for(k = alpm_db_get_pkgcache_list(db); k; k = alpm_list_next(k)) { pmpkg_t *pkg = alpm_list_getdata(k); if(strcmp(alpm_pkg_get_name(pkg), pkgstr) == 0) { @@ -490,7 +490,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) for(j = syncs; j; j = alpm_list_next(j)) { pmdb_t *db = alpm_list_getdata(j); - for(k = alpm_db_get_pkgcache(db); k; k = alpm_list_next(k)) { + for(k = alpm_db_get_pkgcache_list(db); k; k = alpm_list_next(k)) { pmpkg_t *pkg = alpm_list_getdata(k); if(strcmp(alpm_pkg_get_name(pkg), pkgstr) == 0) { @@ -511,7 +511,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) for(i = syncs; i; i = alpm_list_next(i)) { pmdb_t *db = alpm_list_getdata(i); - for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) { + for(j = alpm_db_get_pkgcache_list(db); j; j = alpm_list_next(j)) { dump_pkg_sync(alpm_list_getdata(j), alpm_db_get_name(db), config->op_s_info); } } @@ -555,7 +555,7 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets) for(i = ls; i; i = alpm_list_next(i)) { pmdb_t *db = alpm_list_getdata(i); - for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) { + for(j = alpm_db_get_pkgcache_list(db); j; j = alpm_list_next(j)) { pmpkg_t *pkg = alpm_list_getdata(j); if (!config->quiet) { -- cgit v1.2.3