Remove alpm_option_get_* usage from backend

These are all available directly on the handle without indirection.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-08-19 19:12:21 -05:00
parent d307ed5eb9
commit d9e5dab6ac
6 changed files with 11 additions and 13 deletions

View File

@ -194,8 +194,7 @@ static void *_cache_changelog_open(alpm_pkg_t *pkg)
char clfile[PATH_MAX]; char clfile[PATH_MAX];
alpm_db_t *db = alpm_pkg_get_db(pkg); alpm_db_t *db = alpm_pkg_get_db(pkg);
snprintf(clfile, PATH_MAX, "%s/%s/%s-%s/changelog", snprintf(clfile, PATH_MAX, "%s/%s/%s-%s/changelog",
alpm_option_get_dbpath(pkg->handle), pkg->handle->dbpath, db->treename, pkg->name, pkg->version);
db->treename, pkg->name, pkg->version);
return fopen(clfile, "r"); return fopen(clfile, "r");
} }

View File

@ -41,13 +41,12 @@
static char *get_sync_dir(alpm_handle_t *handle) static char *get_sync_dir(alpm_handle_t *handle)
{ {
const char *dbpath = alpm_option_get_dbpath(handle); size_t len = strlen(handle->dbpath) + 6;
size_t len = strlen(dbpath) + 6;
char *syncpath; char *syncpath;
struct stat buf; struct stat buf;
MALLOC(syncpath, len, RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); 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) { if(stat(syncpath, &buf) != 0) {
_alpm_log(handle, ALPM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n", _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)) { if(_alpm_handle_unlock(handle)) {
_alpm_log(handle, ALPM_LOG_WARNING, _("could not remove lock file %s\n"), _alpm_log(handle, ALPM_LOG_WARNING, _("could not remove lock file %s\n"),
alpm_option_get_lockfile(handle)); handle->lockfile);
} }
free(syncpath); free(syncpath);
umask(oldmask); umask(oldmask);

View File

@ -224,7 +224,7 @@ alpm_siglevel_t SYMEXPORT alpm_db_get_siglevel(alpm_db_t *db)
{ {
ASSERT(db != NULL, return -1); ASSERT(db != NULL, return -1);
if(db->siglevel & ALPM_SIG_USE_DEFAULT) { if(db->siglevel & ALPM_SIG_USE_DEFAULT) {
return alpm_option_get_default_siglevel(db->handle); return db->handle->siglevel;
} else { } else {
return db->siglevel; return db->siglevel;
} }
@ -357,7 +357,7 @@ const char *_alpm_db_path(alpm_db_t *db)
const char *dbpath; const char *dbpath;
size_t pathsize; size_t pathsize;
dbpath = alpm_option_get_dbpath(db->handle); dbpath = db->handle->dbpath;
if(!dbpath) { if(!dbpath) {
_alpm_log(db->handle, ALPM_LOG_ERROR, _("database path is undefined\n")); _alpm_log(db->handle, ALPM_LOG_ERROR, _("database path is undefined\n"));
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, NULL); RET_ERR(db->handle, ALPM_ERR_DB_OPEN, NULL);

View File

@ -211,7 +211,7 @@ static int calculate_installed_size(alpm_handle_t *handle,
/* approximate space requirements for db entries */ /* approximate space requirements for db entries */
if(filename[0] == '.') { if(filename[0] == '.') {
filename = alpm_option_get_dbpath(handle); filename = handle->dbpath;
} }
snprintf(path, PATH_MAX, "%s%s", handle->root, filename); snprintf(path, PATH_MAX, "%s%s", handle->root, filename);

View File

@ -116,7 +116,7 @@ static int init_gpgme(alpm_handle_t *handle)
return 0; return 0;
} }
sigdir = alpm_option_get_gpgdir(handle); sigdir = handle->gpgdir;
if (_alpm_access(handle, sigdir, "pubring.gpg", R_OK) if (_alpm_access(handle, sigdir, "pubring.gpg", R_OK)
|| _alpm_access(handle, sigdir, "trustdb.gpg", R_OK)) { || _alpm_access(handle, sigdir, "trustdb.gpg", R_OK)) {

View File

@ -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 *i;
alpm_list_t *invalid = NULL; alpm_list_t *invalid = NULL;
const char *arch = alpm_option_get_arch(handle); const char *arch = handle->arch;
if(!arch) { if(!arch) {
return NULL; return NULL;
} }
@ -224,9 +224,9 @@ int SYMEXPORT alpm_trans_release(alpm_handle_t *handle)
if(!nolock_flag) { if(!nolock_flag) {
if(_alpm_handle_unlock(handle)) { if(_alpm_handle_unlock(handle)) {
_alpm_log(handle, ALPM_LOG_WARNING, _("could not remove lock file %s\n"), _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_logaction(handle, "warning: could not remove lock file %s\n",
alpm_option_get_lockfile(handle)); handle->lockfile);
} }
} }