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-07-2011, 09:36 PM
Dan McGee
 
Default Require handle for alpm_db_register_sync()

Signed-off-by: Dan McGee <dan@archlinux.org>
---
lib/libalpm/alpm.h | 4 +++-
lib/libalpm/db.c | 5 +----
src/pacman/conf.c | 2 +-
src/util/cleanupdelta.c | 2 +-
src/util/testdb.c | 2 +-
5 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index d63b987..50ab06e 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -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
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 6114334..8156f2a 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -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));
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index a9ff14c..6686f73 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -564,7 +564,7 @@ static int _parseconfig(const char *file, int parse_options,
pm_printf(PM_LOG_DEBUG, "config: new section '%s'
", 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)
"),
name, alpm_strerrorlast());
diff --git a/src/util/cleanupdelta.c b/src/util/cleanupdelta.c
index 83659cd..5112b1a 100644
--- a/src/util/cleanupdelta.c
+++ b/src/util/cleanupdelta.c
@@ -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)
",
alpm_strerrorlast());
diff --git a/src/util/testdb.c b/src/util/testdb.c
index c7640d9..620328e 100644
--- a/src/util/testdb.c
+++ b/src/util/testdb.c
@@ -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)
",
alpm_strerrorlast());
--
1.7.5.2
 

Thread Tools




All times are GMT. The time now is 12:09 AM.

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