From 2aba1bc0583aeb3ee6e26e3bfacd123abef744d9 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Mon, 1 Dec 2008 23:06:22 +0100 Subject: towards ANSI C make _IceProcessCoreMessage and default error handlers static --- include/X11/ICE/ICEmsg.h | 23 +++++++++++++++++++++++ src/error.c | 47 ++++++++++++++++++++++------------------------- src/globals.h | 17 ----------------- src/iceauth.c | 48 +++++++++++++++++++++++------------------------- src/process.c | 26 ++++++++++++++------------ 5 files changed, 82 insertions(+), 79 deletions(-) diff --git a/include/X11/ICE/ICEmsg.h b/include/X11/ICE/ICEmsg.h index ddae027..3329ee9 100644 --- a/include/X11/ICE/ICEmsg.h +++ b/include/X11/ICE/ICEmsg.h @@ -89,6 +89,29 @@ extern void _IceErrorBadValue ( IcePointer /* value */ ); +extern IcePoAuthStatus _IcePoMagicCookie1Proc ( + IceConn /* iceConn */, + IcePointer * /* authStatePtr */, + Bool /* cleanUp */, + Bool /* swap */, + int /* authDataLen */, + IcePointer /* authData */, + int * /* replyDataLenRet */, + IcePointer * /* replyDataRet */, + char ** /* errorStringRet */ +); + +extern IcePaAuthStatus _IcePaMagicCookie1Proc ( + IceConn /* iceConn */, + IcePointer * /* authStatePtr */, + Bool /* swap */, + int /* authDataLen */, + IcePointer /* authData */, + int * /* replyDataLenRet */, + IcePointer * /* replyDataRet */, + char ** /* errorStringRet */ +); + /* * Macro to check if IO operations are valid on an ICE connection. diff --git a/src/error.c b/src/error.c index 8021ad4..f0ce72a 100644 --- a/src/error.c +++ b/src/error.c @@ -369,18 +369,16 @@ int severity; * Default error handler. */ -void -_IceDefaultErrorHandler (iceConn, swap, - offendingMinorOpcode, offendingSequence, errorClass, severity, values) - -IceConn iceConn; -Bool swap; -int offendingMinorOpcode; -unsigned long offendingSequence; -int errorClass; -int severity; -IcePointer values; - +static void +_IceDefaultErrorHandler ( + IceConn iceConn, + Bool swap, + int offendingMinorOpcode, + unsigned long offendingSequence, + int errorClass, + int severity, + IcePointer values +) { char *str; char *pData = (char *) values; @@ -578,6 +576,7 @@ IcePointer values; exit (1); } +IceErrorHandler _IceErrorHandler = _IceDefaultErrorHandler; /* @@ -587,10 +586,9 @@ IcePointer values; */ IceErrorHandler -IceSetErrorHandler (handler) - -IceErrorHandler handler; - +IceSetErrorHandler ( + IceErrorHandler handler +) { IceErrorHandler oldHandler = _IceErrorHandler; @@ -608,11 +606,10 @@ IceErrorHandler handler; * Default IO error handler. */ -void -_IceDefaultIOErrorHandler (iceConn) - -IceConn iceConn; - +static void +_IceDefaultIOErrorHandler ( + IceConn iceConn +) { fprintf (stderr, "ICE default IO error handler doing an exit(), pid = %ld, errno = %d\n", @@ -621,6 +618,7 @@ IceConn iceConn; exit (1); } +IceIOErrorHandler _IceIOErrorHandler = _IceDefaultIOErrorHandler; /* @@ -631,10 +629,9 @@ IceConn iceConn; */ IceIOErrorHandler -IceSetIOErrorHandler (handler) - -IceIOErrorHandler handler; - +IceSetIOErrorHandler ( + IceIOErrorHandler handler +) { IceIOErrorHandler oldHandler = _IceIOErrorHandler; diff --git a/src/globals.h b/src/globals.h index 0532f55..f3d0955 100644 --- a/src/globals.h +++ b/src/globals.h @@ -28,14 +28,6 @@ Author: Ralph Mor, X Consortium ******************************************************************************/ /* $XFree86: xc/lib/ICE/globals.h,v 1.4 2001/12/14 19:53:35 dawes Exp $ */ -extern void _IceDefaultErrorHandler (); -extern void _IceDefaultIOErrorHandler (); - -extern IcePoAuthStatus _IcePoMagicCookie1Proc (); -extern IcePaAuthStatus _IcePaMagicCookie1Proc (); - -extern void _IceProcessCoreMessage (); - #ifndef __UNIXOS2__ IceConn _IceConnectionObjs[256]; char *_IceConnectionStrings[256]; @@ -51,14 +43,5 @@ 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; diff --git a/src/iceauth.c b/src/iceauth.c index dcee7ed..d782954 100644 --- a/src/iceauth.c +++ b/src/iceauth.c @@ -94,19 +94,17 @@ int len; IcePoAuthStatus -_IcePoMagicCookie1Proc (iceConn, authStatePtr, cleanUp, swap, - authDataLen, authData, replyDataLenRet, replyDataRet, errorStringRet) - -IceConn iceConn; -IcePointer *authStatePtr; -Bool cleanUp; -Bool swap; -int authDataLen; -IcePointer authData; -int *replyDataLenRet; -IcePointer *replyDataRet; -char **errorStringRet; - +_IcePoMagicCookie1Proc ( + IceConn iceConn, + IcePointer *authStatePtr, + Bool cleanUp, + Bool swap, + int authDataLen, + IcePointer authData, + int *replyDataLenRet, + IcePointer *replyDataRet, + char **errorStringRet +) { if (cleanUp) { @@ -168,21 +166,20 @@ char **errorStringRet; } } +IcePoAuthProc _IcePoAuthProcs[] = {_IcePoMagicCookie1Proc}; IcePaAuthStatus -_IcePaMagicCookie1Proc (iceConn, authStatePtr, swap, - authDataLen, authData, replyDataLenRet, replyDataRet, errorStringRet) - -IceConn iceConn; -IcePointer *authStatePtr; -Bool swap; -int authDataLen; -IcePointer authData; -int *replyDataLenRet; -IcePointer *replyDataRet; -char **errorStringRet; - +_IcePaMagicCookie1Proc ( + IceConn iceConn, + IcePointer *authStatePtr, + Bool swap, + int authDataLen, + IcePointer authData, + int *replyDataLenRet, + IcePointer *replyDataRet, + char **errorStringRet +) { *errorStringRet = NULL; *replyDataLenRet = 0; @@ -252,6 +249,7 @@ char **errorStringRet; } } +IcePaAuthProc _IcePaAuthProcs[] = {_IcePaMagicCookie1Proc}; /* diff --git a/src/process.c b/src/process.c index 416f1c6..ebb91c3 100644 --- a/src/process.c +++ b/src/process.c @@ -2452,18 +2452,16 @@ unsigned long length; -void -_IceProcessCoreMessage (iceConn, opcode, length, swap, - replyWait, replyReadyRet, connectionClosedRet) - -IceConn iceConn; -int opcode; -unsigned long length; -Bool swap; -IceReplyWaitInfo *replyWait; -Bool *replyReadyRet; -Bool *connectionClosedRet; - +static void +_IceProcessCoreMessage ( + IceConn iceConn, + int opcode, + unsigned long length, + Bool swap, + IceReplyWaitInfo *replyWait, + Bool *replyReadyRet, + Bool *connectionClosedRet +) { Bool replyReady = False; @@ -2542,3 +2540,7 @@ Bool *connectionClosedRet; *replyReadyRet = replyReady; } +int _IceVersionCount = 1; +_IceVersion _IceVersions[] = { + {IceProtoMajor, IceProtoMinor, _IceProcessCoreMessage}}; + -- cgit v1.2.3