summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-07 23:22:58 -0500
committerDan McGee <dan@archlinux.org>2011-06-14 08:26:58 -0500
commit00a1b1deeb390d99c99d942ef4d8bfe1a943b02a (patch)
treeaf1f1843cd068b627f06ff15ec0d191e32e0bf10 /src
parent8be4db8caf8e534afe7ebea1eb913b34b2414a43 (diff)
downloadpacman-00a1b1deeb390d99c99d942ef4d8bfe1a943b02a.tar.xz
Remove alpm_db_get_url()
This method is old, it doesn't adequately check for a NULL server list, and can easily be done using better API method we provide these days. All former users of this method can get similar results by calling alpm_db_get_servers() and using the data from the returned server list. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/util.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c
index a71c3cfd..3b4d0294 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -783,22 +783,19 @@ static off_t pkg_get_size(pmpkg_t *pkg)
static char *pkg_get_location(pmpkg_t *pkg)
{
- pmdb_t *db;
- const char *dburl;
- char *string;
+ alpm_list_t *servers;
+ char *string = NULL;
switch(config->op) {
case PM_OP_SYNC:
- db = alpm_pkg_get_db(pkg);
- dburl = alpm_db_get_url(db);
- if(dburl) {
- char *pkgurl = NULL;
- pm_asprintf(&pkgurl, "%s/%s", dburl, alpm_pkg_get_filename(pkg));
- return pkgurl;
+ servers = alpm_db_get_servers(alpm_pkg_get_db(pkg));
+ if(servers) {
+ pm_asprintf(&string, "%s/%s", alpm_list_getdata(servers),
+ alpm_pkg_get_filename(pkg));
+ return string;
}
case PM_OP_UPGRADE:
return strdup(alpm_pkg_get_filename(pkg));
default:
- string = NULL;
pm_asprintf(&string, "%s-%s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
return string;
}