[pacman-dev] [PATCH] Remove alpm_option_get_* usage from backend

Dan McGee dan at archlinux.org
Fri Aug 19 20:12:49 EDT 2011


These are all available directly on the handle without indirection.

Signed-off-by: Dan McGee <dan at archlinux.org>
---
 lib/libalpm/be_local.c  |    3 +--
 lib/libalpm/be_sync.c   |    7 +++----
 lib/libalpm/db.c        |    4 ++--
 lib/libalpm/diskspace.c |    2 +-
 lib/libalpm/signing.c   |    2 +-
 lib/libalpm/trans.c     |    6 +++---
 6 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 1b48922..f53bd64 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -194,8 +194,7 @@ static void *_cache_changelog_open(alpm_pkg_t *pkg)
 	char clfile[PATH_MAX];
 	alpm_db_t *db = alpm_pkg_get_db(pkg);
 	snprintf(clfile, PATH_MAX, "%s/%s/%s-%s/changelog",
-			alpm_option_get_dbpath(pkg->handle),
-			db->treename, pkg->name, pkg->version);
+			pkg->handle->dbpath, db->treename, pkg->name, pkg->version);
 	return fopen(clfile, "r");
 }
 
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 75f0664..6e64e5f 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -41,13 +41,12 @@
 
 static char *get_sync_dir(alpm_handle_t *handle)
 {
-	const char *dbpath = alpm_option_get_dbpath(handle);
-	size_t len = strlen(dbpath) + 6;
+	size_t len = strlen(handle->dbpath) + 6;
 	char *syncpath;
 	struct stat buf;
 
 	MALLOC(syncpath, len, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
-	sprintf(syncpath, "%s%s", dbpath, "sync/");
+	sprintf(syncpath, "%s%s", handle->dbpath, "sync/");
 
 	if(stat(syncpath, &buf) != 0) {
 		_alpm_log(handle, ALPM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
@@ -260,7 +259,7 @@ cleanup:
 
 	if(_alpm_handle_unlock(handle)) {
 		_alpm_log(handle, ALPM_LOG_WARNING, _("could not remove lock file %s\n"),
-				alpm_option_get_lockfile(handle));
+				handle->lockfile);
 	}
 	free(syncpath);
 	umask(oldmask);
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 33282b8..4b23509 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -224,7 +224,7 @@ alpm_siglevel_t SYMEXPORT alpm_db_get_siglevel(alpm_db_t *db)
 {
 	ASSERT(db != NULL, return -1);
 	if(db->siglevel & ALPM_SIG_USE_DEFAULT) {
-		return alpm_option_get_default_siglevel(db->handle);
+		return db->handle->siglevel;
 	} else {
 		return db->siglevel;
 	}
@@ -357,7 +357,7 @@ const char *_alpm_db_path(alpm_db_t *db)
 		const char *dbpath;
 		size_t pathsize;
 
-		dbpath = alpm_option_get_dbpath(db->handle);
+		dbpath = db->handle->dbpath;
 		if(!dbpath) {
 			_alpm_log(db->handle, ALPM_LOG_ERROR, _("database path is undefined\n"));
 			RET_ERR(db->handle, ALPM_ERR_DB_OPEN, NULL);
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index 1e2fa14..ad80304 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -211,7 +211,7 @@ static int calculate_installed_size(alpm_handle_t *handle,
 
 		/* approximate space requirements for db entries */
 		if(filename[0] == '.') {
-			filename = alpm_option_get_dbpath(handle);
+			filename = handle->dbpath;
 		}
 
 		snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
index 28ce620..4428b54 100644
--- a/lib/libalpm/signing.c
+++ b/lib/libalpm/signing.c
@@ -116,7 +116,7 @@ static int init_gpgme(alpm_handle_t *handle)
 		return 0;
 	}
 
-	sigdir = alpm_option_get_gpgdir(handle);
+	sigdir = handle->gpgdir;
 
 	if (_alpm_access(handle, sigdir, "pubring.gpg", R_OK)
 			|| _alpm_access(handle, sigdir, "trustdb.gpg", R_OK)) {
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 3f59596..c594520 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -82,7 +82,7 @@ static alpm_list_t *check_arch(alpm_handle_t *handle, alpm_list_t *pkgs)
 	alpm_list_t *i;
 	alpm_list_t *invalid = NULL;
 
-	const char *arch = alpm_option_get_arch(handle);
+	const char *arch = handle->arch;
 	if(!arch) {
 		return NULL;
 	}
@@ -224,9 +224,9 @@ int SYMEXPORT alpm_trans_release(alpm_handle_t *handle)
 	if(!nolock_flag) {
 		if(_alpm_handle_unlock(handle)) {
 			_alpm_log(handle, ALPM_LOG_WARNING, _("could not remove lock file %s\n"),
-					alpm_option_get_lockfile(handle));
+					handle->lockfile);
 			alpm_logaction(handle, "warning: could not remove lock file %s\n",
-					alpm_option_get_lockfile(handle));
+					handle->lockfile);
 		}
 	}
 
-- 
1.7.6



More information about the pacman-dev mailing list