From 25339b976fb6d94047c1eba8986d016080e9afed Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Mon, 25 Feb 2008 19:05:32 -0300 Subject: [PATCH] Allow globals.h to be included by other files Data declarations from globals.h was moved to connect.c, and files with missing prototypes now include globals.h. --- src/connect.c | 27 +++++++++++++++++++++++++++ src/error.c | 2 +- src/globals.h | 32 ++++++-------------------------- src/iceauth.c | 2 ++ src/process.c | 1 + 5 files changed, 37 insertions(+), 27 deletions(-) diff --git a/src/connect.c b/src/connect.c index 5ac1041..e885568 100644 --- a/src/connect.c +++ b/src/connect.c @@ -39,6 +39,33 @@ Author: Ralph Mor, X Consortium static XtransConnInfo ConnectToPeer(char *networkIdsList, char **actualConnectionRet); +#ifndef __UNIXOS2__ +IceConn _IceConnectionObjs[256]; +char *_IceConnectionStrings[256]; +_IceProtocol _IceProtocols[255]; +#else +IceConn _IceConnectionObjs[256] = {0}; +char *_IceConnectionStrings[256] = {0}; +_IceProtocol _IceProtocols[255] = {0}; +#endif +int _IceConnectionCount = 0; + +int _IceLastMajorOpcode = 0; + +int _IceAuthCount = 1; +char *_IceAuthNames[] = {"MIT-MAGIC-COOKIE-1"}; +IcePoAuthProc _IcePoAuthProcs[] = {_IcePoMagicCookie1Proc}; +IcePaAuthProc _IcePaAuthProcs[] = {_IcePaMagicCookie1Proc}; + +int _IceVersionCount = 1; +_IceVersion _IceVersions[] = { + {IceProtoMajor, IceProtoMinor, _IceProcessCoreMessage}}; + +_IceWatchProc *_IceWatchProcs = NULL; + +IceErrorHandler _IceErrorHandler = _IceDefaultErrorHandler; +IceIOErrorHandler _IceIOErrorHandler = _IceDefaultIOErrorHandler; + #define Strstr strstr IceConn diff --git a/src/error.c b/src/error.c index f61d271..530c119 100644 --- a/src/error.c +++ b/src/error.c @@ -37,7 +37,7 @@ Author: Ralph Mor, X Consortium #include #include - +#include "globals.h" void _IceErrorBadMinor ( diff --git a/src/globals.h b/src/globals.h index 4f41add..7482b95 100644 --- a/src/globals.h +++ b/src/globals.h @@ -28,6 +28,11 @@ Author: Ralph Mor, X Consortium ******************************************************************************/ /* $XFree86: xc/lib/ICE/globals.h,v 1.4 2001/12/14 19:53:35 dawes Exp $ */ +#ifndef _ICEGLOBALS_H_ +#define _ICEGLOBALS_H_ + +#include + extern void _IceDefaultErrorHandler ( IceConn /* iceConn */, Bool /* swap */, @@ -75,29 +80,4 @@ extern void _IceProcessCoreMessage ( Bool * /* connectionClosedRet */ ); -#ifndef __UNIXOS2__ -IceConn _IceConnectionObjs[256]; -char *_IceConnectionStrings[256]; -_IceProtocol _IceProtocols[255]; -#else -IceConn _IceConnectionObjs[256] = {0}; -char *_IceConnectionStrings[256] = {0}; -_IceProtocol _IceProtocols[255] = {0}; -#endif -int _IceConnectionCount = 0; - -int _IceLastMajorOpcode = 0; - -int _IceAuthCount = 1; -char *_IceAuthNames[] = {"MIT-MAGIC-COOKIE-1"}; -IcePoAuthProc _IcePoAuthProcs[] = {_IcePoMagicCookie1Proc}; -IcePaAuthProc _IcePaAuthProcs[] = {_IcePaMagicCookie1Proc}; - -int _IceVersionCount = 1; -_IceVersion _IceVersions[] = { - {IceProtoMajor, IceProtoMinor, _IceProcessCoreMessage}}; - -_IceWatchProc *_IceWatchProcs = NULL; - -IceErrorHandler _IceErrorHandler = _IceDefaultErrorHandler; -IceIOErrorHandler _IceIOErrorHandler = _IceDefaultIOErrorHandler; +#endif /* _ICEGLOBALS_H_ */ diff --git a/src/iceauth.c b/src/iceauth.c index fa05287..7c3ec5b 100644 --- a/src/iceauth.c +++ b/src/iceauth.c @@ -38,6 +38,8 @@ Author: Ralph Mor, X Consortium #include #define Time_t time_t +#include "globals.h" + static int binaryEqual (const char *a, const char *b, unsigned len); static int was_called_state; diff --git a/src/process.c b/src/process.c index 188131f..940b9e9 100644 --- a/src/process.c +++ b/src/process.c @@ -35,6 +35,7 @@ Author: Ralph Mor, X Consortium #include "ICElibint.h" #include /* sprintf */ +#include "globals.h" /* * Check for bad length -- 1.5.3.5