FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-08-2011, 07:51 AM
Dan McGee
 
Default 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.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
lib/libalpm/alpm.h | 6 ------
lib/libalpm/db.c | 13 -------------
src/pacman/util.c | 17 +++++++----------
3 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 329ffd7..37bea6d 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -301,12 +301,6 @@ int alpm_db_unregister_all(pmhandle_t *handle);
*/
const char *alpm_db_get_name(const pmdb_t *db);

-/** Get a download URL for the package database.
- * @param db pointer to the package database
- * @return a fully-specified download URL, NULL on error
- */
-const char *alpm_db_get_url(const pmdb_t *db);
-
/** Check the validity of a database.
* This is most useful for sync databases and verifying signature status.
* If invalid, the handle error code will be set accordingly.
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index e740acb..4a2cbab 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -232,19 +232,6 @@ const char SYMEXPORT *alpm_db_get_name(const pmdb_t *db)
return db->treename;
}

-/** Get a download URL for the package database. */
-const char SYMEXPORT *alpm_db_get_url(const pmdb_t *db)
-{
- char *url;
-
- ASSERT(db != NULL, return NULL);
- ASSERT(db->servers != NULL, return NULL);
-
- url = (char *)db->servers->data;
-
- return url;
-}
-
/** Check the validity of a database. */
int SYMEXPORT alpm_db_valid(pmdb_t *db)
{
diff --git a/src/pacman/util.c b/src/pacman/util.c
index ce305a4..21e3ad8 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -804,22 +804,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;
}
--
1.7.5.2
 

Thread Tools




All times are GMT. The time now is 07:12 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org