mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-08 12:28:00 -05:00
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 <dan@archlinux.org>
This commit is contained in:
parent
006387828c
commit
86ca39d15e
@ -32,7 +32,6 @@
|
||||
#include "util.h"
|
||||
|
||||
/* Globals */
|
||||
pmhandle_t *handle = NULL;
|
||||
enum _pmerrno_t pm_errno SYMEXPORT;
|
||||
|
||||
/** \addtogroup alpm_interface Interface Functions
|
||||
|
@ -39,8 +39,6 @@
|
||||
#include "provide.h"
|
||||
#include "handle.h"
|
||||
|
||||
extern pmhandle_t *handle;
|
||||
|
||||
static pmgraph_t *_alpm_graph_new(void)
|
||||
{
|
||||
pmgraph_t *graph = NULL;
|
||||
|
@ -43,6 +43,9 @@
|
||||
#include "alpm.h"
|
||||
#include "server.h"
|
||||
|
||||
/* global var for handle (private to libalpm) */
|
||||
pmhandle_t *handle = NULL;
|
||||
|
||||
pmhandle_t *_alpm_handle_new()
|
||||
{
|
||||
pmhandle_t *handle;
|
||||
|
@ -64,6 +64,7 @@ typedef struct _pmhandle_t {
|
||||
unsigned short usedelta; /* Download deltas if possible */
|
||||
} pmhandle_t;
|
||||
|
||||
/* global handle variable */
|
||||
extern pmhandle_t *handle;
|
||||
|
||||
pmhandle_t *_alpm_handle_new();
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user