From 86ca39d15e02dff47b5b0f5bcd0494cf101ce0c1 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 4 Nov 2007 12:05:22 -0600 Subject: Clean up usage of extern variables Instead of declaring the extern variable in every *.c file, include it in the header file that makes sense. This means handle.h for the handle, and conf.h for the pacman side config object. Signed-off-by: Dan McGee --- src/pacman/add.c | 2 -- src/pacman/callback.c | 2 -- src/pacman/conf.c | 3 +++ src/pacman/conf.h | 3 +++ src/pacman/deptest.c | 2 -- src/pacman/pacman.c | 2 -- src/pacman/query.c | 1 - src/pacman/remove.c | 2 -- src/pacman/sync.c | 1 - src/pacman/util.c | 2 -- 10 files changed, 6 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/pacman/add.c b/src/pacman/add.c index f883a6bd..987e62cb 100644 --- a/src/pacman/add.c +++ b/src/pacman/add.c @@ -34,8 +34,6 @@ #include "conf.h" #include "util.h" -extern config_t *config; - /* Free the current transaction and print an error if unsuccessful */ static int add_cleanup(void) { diff --git a/src/pacman/callback.c b/src/pacman/callback.c index ccc482f8..a68b0a48 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -40,8 +40,6 @@ #define LOG_STR_LEN 256 #define FILENAME_TRIM_LEN 23 -extern config_t *config; - /* download progress bar */ static float rate_last; static int xfered_last; diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 21256d77..9b5850d7 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -28,6 +28,9 @@ /* pacman */ #include "conf.h" +/* global config variable */ +config_t *config = NULL; + config_t *config_new(void) { config_t *newconfig = calloc(1, sizeof(config_t)); diff --git a/src/pacman/conf.h b/src/pacman/conf.h index 4283af7d..7249f068 100644 --- a/src/pacman/conf.h +++ b/src/pacman/conf.h @@ -78,6 +78,9 @@ enum { PM_OP_DEPTEST }; +/* global config variable */ +extern config_t *config; + config_t *config_new(void); int config_free(config_t *oldconfig); diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c index 7f89f6d2..301558e9 100644 --- a/src/pacman/deptest.c +++ b/src/pacman/deptest.c @@ -33,8 +33,6 @@ #include "util.h" #include "conf.h" -extern config_t *config; - /* TODO: This should use _alpm_checkdeps() */ int pacman_deptest(alpm_list_t *targets) { diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 3859c8d3..befd0219 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -47,8 +47,6 @@ #include "conf.h" #include "package.h" -config_t *config; - pmdb_t *db_local; /* list of targets specified on command line */ static alpm_list_t *pm_targets; diff --git a/src/pacman/query.c b/src/pacman/query.c index 42e163ef..ed48799c 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -38,7 +38,6 @@ #include "conf.h" #include "util.h" -extern config_t *config; extern pmdb_t *db_local; static char *resolve_path(const char* file) diff --git a/src/pacman/remove.c b/src/pacman/remove.c index dce479ec..5bd3b5c3 100644 --- a/src/pacman/remove.c +++ b/src/pacman/remove.c @@ -34,8 +34,6 @@ #include "callback.h" #include "conf.h" -extern config_t *config; - extern pmdb_t *db_local; /* Free the current transaction and print an error if unsuccessful */ diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 9e4b0ada..eedea7d4 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -41,7 +41,6 @@ #include "callback.h" #include "conf.h" -extern config_t *config; extern pmdb_t *db_local; static int sync_cleancache(int level) diff --git a/src/pacman/util.c b/src/pacman/util.c index ecdb2ad8..7af51daa 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -44,8 +44,6 @@ #include "util.h" #include "conf.h" -extern config_t *config; - int needs_transaction() { if(config->op != PM_OP_MAIN && config->op != PM_OP_QUERY && config->op != PM_OP_DEPTEST) { -- cgit v1.2.3-24-g4f1b