From dc5f74e9bee49435daa31938051bb55bacf42902 Mon Sep 17 00:00:00 2001 From: TLINDEN Date: Sun, 1 Dec 2013 16:15:41 +0100 Subject: [PATCH] fixed global variables, made them extern in *.h files --- include/pcp/defines.h | 6 +++--- include/pcp/keyhash.h | 8 ++++---- libpcp/fatal.c | 4 ++++ libpcp/keyhash.c | 5 +++++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/include/pcp/defines.h b/include/pcp/defines.h index a562f1a..8a5f862 100644 --- a/include/pcp/defines.h +++ b/include/pcp/defines.h @@ -65,9 +65,9 @@ typedef unsigned int qbyte; // Quad byte = 32 bits // sigs #define PCP_SIG_VERSION 2 -char *PCP_ERR; -byte PCP_ERRSET; -int PCP_EXIT; +extern char *PCP_ERR; +extern byte PCP_ERRSET; +extern int PCP_EXIT; //set error void fatal(const char * fmt, ...); diff --git a/include/pcp/keyhash.h b/include/pcp/keyhash.h index 2cb85c3..9ff24cf 100644 --- a/include/pcp/keyhash.h +++ b/include/pcp/keyhash.h @@ -25,10 +25,10 @@ #include "uthash.h" #include "key.h" -pcp_key_t *pcpkey_hash; -pcp_pubkey_t *pcppubkey_hash; -pcp_key_t *__k; -pcp_pubkey_t *__p; +extern pcp_key_t *pcpkey_hash; +extern pcp_pubkey_t *pcppubkey_hash; +extern pcp_key_t *__k; +extern pcp_pubkey_t *__p; // wrapper for HASH_ITER #define pcphash_iterate(key) \ diff --git a/libpcp/fatal.c b/libpcp/fatal.c index fcc0896..4e66364 100644 --- a/libpcp/fatal.c +++ b/libpcp/fatal.c @@ -29,6 +29,10 @@ #include #include +char *PCP_ERR; +byte PCP_ERRSET; +int PCP_EXIT; + void fatal(const char * fmt, ...) { va_list ap; va_start(ap, fmt); diff --git a/libpcp/keyhash.c b/libpcp/keyhash.c index d422af9..7ed70e8 100644 --- a/libpcp/keyhash.c +++ b/libpcp/keyhash.c @@ -22,6 +22,11 @@ #include "keyhash.h" +pcp_key_t *pcpkey_hash; +pcp_pubkey_t *pcppubkey_hash; +pcp_key_t *__k; +pcp_pubkey_t *__p; + void pcphash_init() { pcpkey_hash = NULL; pcppubkey_hash = NULL;