1
0
mirror of https://github.com/moparisthebest/pacman synced 2025-01-08 12:28:00 -05:00

Require handle for alpm_db_register_sync()

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-06-07 13:34:30 -05:00
parent 24000b83c9
commit 7d27cf8364
5 changed files with 7 additions and 8 deletions

View File

@ -268,15 +268,17 @@ pmdb_t *alpm_option_get_localdb(pmhandle_t *handle);
/** Get the list of sync databases.
* Returns a list of pmdb_t structures, one for each registered
* sync database.
* @param handle the context handle
* @return a reference to an internal list of pmdb_t structures
*/
alpm_list_t *alpm_option_get_syncdbs(pmhandle_t *handle);
/** Register a sync database of packages.
* @param handle the context handle
* @param treename the name of the sync repository
* @return a pmdb_t* on success (the value), NULL on error
*/
pmdb_t *alpm_db_register_sync(const char *treename);
pmdb_t *alpm_db_register_sync(pmhandle_t *handle, const char *treename);
/** Unregister a package database.
* @param db pointer to the package database to unregister

View File

@ -39,16 +39,13 @@
#include "package.h"
#include "group.h"
/* global handle variable */
extern pmhandle_t *handle;
/** \addtogroup alpm_databases Database Functions
* @brief Functions to query and manipulate the database of libalpm
* @{
*/
/** Register a sync database of packages. */
pmdb_t SYMEXPORT *alpm_db_register_sync(const char *treename)
pmdb_t SYMEXPORT *alpm_db_register_sync(pmhandle_t *handle, const char *treename)
{
/* Sanity checks */
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, NULL));

View File

@ -564,7 +564,7 @@ static int _parseconfig(const char *file, int parse_options,
pm_printf(PM_LOG_DEBUG, "config: new section '%s'\n", name);
/* if we are not looking at the options section, register a db */
if(!parse_options && strcmp(name, "options") != 0) {
db = alpm_db_register_sync(name);
db = alpm_db_register_sync(config->handle, name);
if(db == NULL) {
pm_printf(PM_LOG_ERROR, _("could not register '%s' database (%s)\n"),
name, alpm_strerrorlast());

View File

@ -75,7 +75,7 @@ static void checkdbs(const char *dbpath, alpm_list_t *dbnames) {
for(i = dbnames; i; i = alpm_list_next(i)) {
char *dbname = alpm_list_getdata(i);
snprintf(syncdbpath, PATH_MAX, "%s/sync/%s", dbpath, dbname);
db = alpm_db_register_sync(dbname);
db = alpm_db_register_sync(handle, dbname);
if(db == NULL) {
fprintf(stderr, "error: could not register sync database (%s)\n",
alpm_strerrorlast());

View File

@ -152,7 +152,7 @@ static int check_syncdbs(alpm_list_t *dbnames) {
for(i = dbnames; i; i = alpm_list_next(i)) {
char *dbname = alpm_list_getdata(i);
db = alpm_db_register_sync(dbname);
db = alpm_db_register_sync(handle, dbname);
if(db == NULL) {
fprintf(stderr, "error: could not register sync database (%s)\n",
alpm_strerrorlast());