Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-03-29 20:52:22 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-03-29 20:52:22 +0000
commitcca46deb6f76a4b846555819b69ac9e22459dff6 (patch)
treec91124338dae08f7258ab42b6d43d872340569cc /lib/libalpm
parentd16c8be8a05a0b7fc9e1146d63bd13b5e3718fba (diff)
changed alpm_db_register() prototype
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/alpm.c29
-rw-r--r--lib/libalpm/alpm.h2
2 files changed, 16 insertions, 15 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index e4000911..9789f467 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -141,36 +141,37 @@ int alpm_get_option(unsigned char parm, long *data)
* Databases
*/
-int alpm_db_register(char *treename, PM_DB **db)
+PM_DB *alpm_db_register(char *treename)
{
+ pmdb_t *db;
+
/* Sanity checks */
- ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
- ASSERT(treename != NULL && strlen(treename) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1));
- ASSERT(db != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
+ ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, NULL));
+ ASSERT(treename != NULL && strlen(treename) != 0, RET_ERR(PM_ERR_WRONG_ARGS, NULL));
/* ORE
check if the db if already registered */
- *db = db_open(handle->root, handle->dbpath, treename);
- if(*db == NULL) {
+ db = db_open(handle->root, handle->dbpath, treename);
+ if(db == NULL) {
/* couldn't open the db directory - try creating it */
if(db_create(handle->root, handle->dbpath, treename) == -1) {
- RET_ERR(PM_ERR_DB_CREATE, -1);
+ RET_ERR(PM_ERR_DB_CREATE, NULL);
}
- *db = db_open(handle->root, handle->dbpath, treename);
- if(*db == NULL) {
- /* couldn't open the db directory, try creating it */
- RET_ERR(PM_ERR_DB_OPEN, -1);
+ db = db_open(handle->root, handle->dbpath, treename);
+ if(db == NULL) {
+ /* couldn't open the db directory */
+ RET_ERR(PM_ERR_DB_OPEN, NULL);
}
}
if(strcmp(treename, "local") == 0) {
- handle->db_local = *db;
+ handle->db_local = db;
} else {
- handle->dbs_sync = pm_list_add(handle->dbs_sync, *db);
+ handle->dbs_sync = pm_list_add(handle->dbs_sync, db);
}
- return(0);
+ return(db);
}
int alpm_db_unregister(PM_DB *db)
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 451196f7..6f2980e0 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -93,7 +93,7 @@ int alpm_get_option(unsigned char parm, long *data);
* Databases
*/
-int alpm_db_register(char *treename, PM_DB **db);
+PM_DB *alpm_db_register(char *treename);
int alpm_db_unregister(PM_DB *db);
int alpm_db_getlastupdate(PM_DB *db, char *ts);