Move global variables from .h to .c files

Simplify things by moving the definition of global variables into .c
files, where they belong.
This commit is contained in:
Holger Weiss 2013-09-10 22:45:45 +02:00
parent b48cb1f130
commit 5b0e00782d
5 changed files with 14 additions and 22 deletions

View file

@ -27,11 +27,12 @@
*
*****************************************************************************/
#define LOCAL_TIMEOUT_ALARM_HANDLER
#include "common.h"
#include "netutils.h"
unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
unsigned int socket_timeout_state = STATE_CRITICAL;
int econn_refuse_state = STATE_CRITICAL;
int was_refused = FALSE;
#if USE_IPV6

View file

@ -81,20 +81,14 @@ void host_or_die(const char *str);
# define is_hostname(addr) resolve_host_or_addr(addr, AF_INET)
#endif
#ifdef LOCAL_TIMEOUT_ALARM_HANDLER
extern unsigned int socket_timeout;
extern int socket_timeout_state;
RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
#else
unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
unsigned int socket_timeout_state = STATE_CRITICAL;
extern RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
#endif
extern unsigned int socket_timeout_state;
extern int econn_refuse_state;
extern int was_refused;
extern int address_family;
RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
/* SSL-Related functionality */
#ifdef HAVE_SSL
/* maybe this could be merged with the above np_net_connect, via some flags */

View file

@ -27,7 +27,6 @@
*****************************************************************************/
#define MAX_CN_LENGTH 256
#define LOCAL_TIMEOUT_ALARM_HANDLER
#include "common.h"
#include "netutils.h"

View file

@ -22,8 +22,6 @@
*
*****************************************************************************/
#define LOCAL_TIMEOUT_ALARM_HANDLER
#include "common.h"
#include "utils.h"
#include "utils_base.h"
@ -38,6 +36,11 @@ extern const char *progname;
#define STRLEN 64
#define TXTBLK 128
unsigned int timeout_state = STATE_CRITICAL;
unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
time_t start_time, end_time;
/* **************************************************************************
* max_state(STATE_x, STATE_y)
* compares STATE_x to STATE_y and returns result based on the following

View file

@ -31,17 +31,12 @@ void print_revision (const char *, const char *);
/* Handle timeouts */
#ifdef LOCAL_TIMEOUT_ALARM_HANDLER
extern unsigned int timeout_state;
extern unsigned int timeout_interval;
RETSIGTYPE timeout_alarm_handler (int);
#else
unsigned int timeout_state = STATE_CRITICAL;
unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
extern RETSIGTYPE timeout_alarm_handler (int);
#endif
time_t start_time, end_time;
RETSIGTYPE timeout_alarm_handler (int);
extern time_t start_time, end_time;
/* Test input types */