mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-10 13:28:12 -05:00
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>
This commit is contained in:
parent
8be4db8caf
commit
00a1b1deeb
@ -298,12 +298,6 @@ int alpm_db_unregister_all(pmhandle_t *handle);
|
|||||||
*/
|
*/
|
||||||
const char *alpm_db_get_name(const pmdb_t *db);
|
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);
|
|
||||||
|
|
||||||
/** @name Accessors to the list of servers for a database.
|
/** @name Accessors to the list of servers for a database.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
@ -231,20 +231,6 @@ const char SYMEXPORT *alpm_db_get_name(const pmdb_t *db)
|
|||||||
return db->treename;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Get a package entry from a package database. */
|
/** Get a package entry from a package database. */
|
||||||
pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
|
pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
|
||||||
{
|
{
|
||||||
|
@ -783,22 +783,19 @@ static off_t pkg_get_size(pmpkg_t *pkg)
|
|||||||
|
|
||||||
static char *pkg_get_location(pmpkg_t *pkg)
|
static char *pkg_get_location(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
pmdb_t *db;
|
alpm_list_t *servers;
|
||||||
const char *dburl;
|
char *string = NULL;
|
||||||
char *string;
|
|
||||||
switch(config->op) {
|
switch(config->op) {
|
||||||
case PM_OP_SYNC:
|
case PM_OP_SYNC:
|
||||||
db = alpm_pkg_get_db(pkg);
|
servers = alpm_db_get_servers(alpm_pkg_get_db(pkg));
|
||||||
dburl = alpm_db_get_url(db);
|
if(servers) {
|
||||||
if(dburl) {
|
pm_asprintf(&string, "%s/%s", alpm_list_getdata(servers),
|
||||||
char *pkgurl = NULL;
|
alpm_pkg_get_filename(pkg));
|
||||||
pm_asprintf(&pkgurl, "%s/%s", dburl, alpm_pkg_get_filename(pkg));
|
return string;
|
||||||
return pkgurl;
|
|
||||||
}
|
}
|
||||||
case PM_OP_UPGRADE:
|
case PM_OP_UPGRADE:
|
||||||
return strdup(alpm_pkg_get_filename(pkg));
|
return strdup(alpm_pkg_get_filename(pkg));
|
||||||
default:
|
default:
|
||||||
string = NULL;
|
|
||||||
pm_asprintf(&string, "%s-%s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
|
pm_asprintf(&string, "%s-%s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user