From 2c7faa561fc5d7068b19203905c442f90cf2249d Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Tue, 26 Feb 2008 16:14:45 -0300 Subject: [PATCH] libSM ansification. No binary interfaces should change as there were no prototypes that could cause type promotion. --- src/globals.h | 21 ++++++- src/sm_client.c | 172 +++++++++++++++++++++++++++--------------------------- src/sm_error.c | 45 +++++--------- src/sm_genid.c | 3 +- src/sm_manager.c | 106 ++++++++++++++------------------- src/sm_misc.c | 63 +++++--------------- src/sm_process.c | 33 +++++------ 7 files changed, 196 insertions(+), 247 deletions(-) diff --git a/src/globals.h b/src/globals.h index 40b0ffc..ec00fe2 100644 --- a/src/globals.h +++ b/src/globals.h @@ -31,8 +31,25 @@ in this Software without prior written authorization from The Open Group. * Author: Ralph Mor, X Consortium */ -extern void _SmcDefaultErrorHandler (); -extern void _SmsDefaultErrorHandler (); +extern void _SmcDefaultErrorHandler( + SmcConn /* smcConn */, + Bool /* swap */, + int /* offendingMinorOpcode */, + unsigned long /* offendingSequence */, + int /* errorClass */, + int /* severity */, + SmPointer /* values */ +); + +extern void _SmsDefaultErrorHandler ( + SmsConn /* smsConn */, + Bool /* swap */, + int /* offendingMinorOpcode */, + unsigned long /* offendingSequence */, + int /* errorClass */, + int /* severity */, + SmPointer /* values */ +); int _SmcOpcode = 0; int _SmsOpcode = 0; diff --git a/src/sm_client.c b/src/sm_client.c index 03ffc0e..ca11bb3 100644 --- a/src/sm_client.c +++ b/src/sm_client.c @@ -38,27 +38,48 @@ in this Software without prior written authorization from The Open Group. #include "SMlibint.h" #include "globals.h" -extern IcePoAuthStatus _IcePoMagicCookie1Proc (); -extern void _SmcProcessMessage (); -static void set_callbacks(); +extern IcePoAuthStatus _IcePoMagicCookie1Proc ( + IceConn /* iceConn */, + IcePointer * /* authStatePtr */, + Bool /* cleanUp */, + Bool /* swap */, + int /* authDataLen */, + IcePointer /* authData */, + int * /* replyDataLenRet */, + IcePointer * /* replyDataRet */, + char ** /* errorStringRet */ +); + +extern void _SmcProcessMessage ( + IceConn /* iceConn */, + IcePointer /* clientData */, + int /* opcode */, + unsigned long /* length */, + Bool /* swap */, + IceReplyWaitInfo * /* replyWait */, + Bool * /* replyReadyRet */ +); + +static void set_callbacks ( + SmcConn smcConn, + unsigned long mask, + SmcCallbacks *callbacks +); + SmcConn -SmcOpenConnection (networkIdsList, context, - xsmpMajorRev, xsmpMinorRev, mask, callbacks, - previousId, clientIdRet, errorLength, errorStringRet) - -char *networkIdsList; -SmPointer context; -int xsmpMajorRev; -int xsmpMinorRev; -unsigned long mask; -SmcCallbacks *callbacks; -char *previousId; -char **clientIdRet; -int errorLength; -char *errorStringRet; - +SmcOpenConnection ( + char *networkIdsList, + SmPointer context, + int xsmpMajorRev, + int xsmpMinorRev, + unsigned long mask, + SmcCallbacks *callbacks, + char *previousId, + char **clientIdRet, + int errorLength, + char *errorStringRet) { SmcConn smcConn; IceConn iceConn; @@ -284,12 +305,10 @@ char *errorStringRet; SmcCloseStatus -SmcCloseConnection (smcConn, count, reasonMsgs) - -SmcConn smcConn; -int count; -char **reasonMsgs; - +SmcCloseConnection ( + SmcConn smcConn, + int count, + char **reasonMsgs) { IceConn iceConn = smcConn->iceConn; smCloseConnectionMsg *pMsg; @@ -357,12 +376,10 @@ char **reasonMsgs; void -SmcModifyCallbacks (smcConn, mask, callbacks) - -SmcConn smcConn; -unsigned long mask; -SmcCallbacks *callbacks; - +SmcModifyCallbacks ( + SmcConn smcConn, + unsigned long mask, + SmcCallbacks *callbacks) { set_callbacks (smcConn, mask, callbacks); } @@ -370,12 +387,10 @@ SmcCallbacks *callbacks; void -SmcSetProperties (smcConn, numProps, props) - -SmcConn smcConn; -int numProps; -SmProp **props; - +SmcSetProperties ( + SmcConn smcConn, + int numProps, + SmProp **props) { IceConn iceConn = smcConn->iceConn; smSetPropertiesMsg *pMsg; @@ -400,12 +415,10 @@ SmProp **props; void -SmcDeleteProperties (smcConn, numProps, propNames) - -SmcConn smcConn; -int numProps; -char **propNames; - +SmcDeleteProperties ( + SmcConn smcConn, + int numProps, + char **propNames) { IceConn iceConn = smcConn->iceConn; smDeletePropertiesMsg *pMsg; @@ -433,12 +446,10 @@ char **propNames; Status -SmcGetProperties (smcConn, propReplyProc, clientData) - -SmcConn smcConn; -SmcPropReplyProc propReplyProc; -SmPointer clientData; - +SmcGetProperties ( + SmcConn smcConn, + SmcPropReplyProc propReplyProc, + SmPointer clientData) { IceConn iceConn = smcConn->iceConn; _SmcPropReplyWait *wait, *ptr; @@ -471,13 +482,11 @@ SmPointer clientData; Status -SmcInteractRequest (smcConn, dialogType, interactProc, clientData) - -SmcConn smcConn; -int dialogType; -SmcInteractProc interactProc; -SmPointer clientData; - +SmcInteractRequest ( + SmcConn smcConn, + int dialogType, + SmcInteractProc interactProc, + SmPointer clientData) { IceConn iceConn = smcConn->iceConn; smInteractRequestMsg *pMsg; @@ -515,11 +524,9 @@ SmPointer clientData; void -SmcInteractDone (smcConn, cancelShutdown) - -SmcConn smcConn; -Bool cancelShutdown; - +SmcInteractDone ( + SmcConn smcConn, + Bool cancelShutdown) { IceConn iceConn = smcConn->iceConn; smInteractDoneMsg *pMsg; @@ -535,16 +542,13 @@ Bool cancelShutdown; void -SmcRequestSaveYourself (smcConn, saveType, shutdown, interactStyle, - fast, global) - -SmcConn smcConn; -int saveType; -Bool shutdown; -int interactStyle; -Bool fast; -Bool global; - +SmcRequestSaveYourself ( + SmcConn smcConn, + int saveType, + Bool shutdown, + int interactStyle, + Bool fast, + Bool global) { IceConn iceConn = smcConn->iceConn; smSaveYourselfRequestMsg *pMsg; @@ -564,12 +568,10 @@ Bool global; Status -SmcRequestSaveYourselfPhase2 (smcConn, saveYourselfPhase2Proc, clientData) - -SmcConn smcConn; -SmcSaveYourselfPhase2Proc saveYourselfPhase2Proc; -SmPointer clientData; - +SmcRequestSaveYourselfPhase2 ( + SmcConn smcConn, + SmcSaveYourselfPhase2Proc saveYourselfPhase2Proc, + SmPointer clientData) { IceConn iceConn = smcConn->iceConn; _SmcPhase2Wait *wait; @@ -599,11 +601,9 @@ SmPointer clientData; void -SmcSaveYourselfDone (smcConn, success) - -SmcConn smcConn; -Bool success; - +SmcSaveYourselfDone ( + SmcConn smcConn, + Bool success) { IceConn iceConn = smcConn->iceConn; smSaveYourselfDoneMsg *pMsg; @@ -619,12 +619,10 @@ Bool success; static void -set_callbacks (smcConn, mask, callbacks) - -SmcConn smcConn; -unsigned long mask; -SmcCallbacks *callbacks; - +set_callbacks ( + SmcConn smcConn, + unsigned long mask, + SmcCallbacks *callbacks) { if (mask & SmcSaveYourselfProcMask) { diff --git a/src/sm_error.c b/src/sm_error.c index 615cead..17b85bc 100644 --- a/src/sm_error.c +++ b/src/sm_error.c @@ -45,18 +45,14 @@ in this Software without prior written authorization from The Open Group. */ void -_SmcDefaultErrorHandler (smcConn, swap, - offendingMinorOpcode, offendingSequence, - errorClass, severity, values) - -SmcConn smcConn; -Bool swap; -int offendingMinorOpcode; -unsigned long offendingSequence; -int errorClass; -int severity; -SmPointer values; - +_SmcDefaultErrorHandler ( + SmcConn smcConn, + Bool swap, + int offendingMinorOpcode, + unsigned long offendingSequence, + int errorClass, + int severity, + SmPointer values) { char *pData = (char *) values; const char *str; @@ -177,18 +173,14 @@ SmPointer values; */ void -_SmsDefaultErrorHandler (smsConn, swap, - offendingMinorOpcode, offendingSequence, - errorClass, severity, values) - -SmsConn smsConn; -Bool swap; -int offendingMinorOpcode; -unsigned long offendingSequence; -int errorClass; -int severity; -SmPointer values; - +_SmsDefaultErrorHandler ( + SmsConn smsConn, + Bool swap, + int offendingMinorOpcode, + unsigned long offendingSequence, + int errorClass, + int severity, + SmPointer values) { char *pData = (char *) values; const char *str; @@ -325,10 +317,7 @@ SmcErrorHandler handler; */ SmsErrorHandler -SmsSetErrorHandler (handler) - -SmsErrorHandler handler; - +SmsSetErrorHandler (SmsErrorHandler handler) { SmsErrorHandler oldHandler = _SmsErrorHandler; diff --git a/src/sm_genid.c b/src/sm_genid.c index 1d1e0a3..f6031eb 100644 --- a/src/sm_genid.c +++ b/src/sm_genid.c @@ -80,8 +80,7 @@ in this Software without prior written authorization from The Open Group. char * -SmsGenerateClientID (smsConn) - SmsConn smsConn; +SmsGenerateClientID (SmsConn smsConn) { #if defined(TCPCONN) || defined(STREAMSCONN) static const char hex[] = "0123456789abcdef"; diff --git a/src/sm_manager.c b/src/sm_manager.c index 51ac548..1b30bc0 100644 --- a/src/sm_manager.c +++ b/src/sm_manager.c @@ -42,8 +42,24 @@ in this Software without prior written authorization from The Open Group. #undef shutdown #endif -extern IcePaAuthStatus _IcePaMagicCookie1Proc (); -extern void _SmsProcessMessage (); +extern IcePaAuthStatus _IcePaMagicCookie1Proc ( + IceConn /* iceConn */, + IcePointer * /* authStatePtr */, + Bool /* swap */, + int /* authDataLen */, + IcePointer /* authData */, + int * /* replyDataLenRet */, + IcePointer * /* replyDataRet */, + char ** /* errorStringRet */ +); + +extern void _SmsProcessMessage ( + IceConn /* iceConn */, + IcePointer /* clientData */, + int /* opcode */, + unsigned long /* length */, + Bool /* swap */ +); @@ -117,17 +133,14 @@ _SmsProtocolSetupProc (IceConn iceConn, Status -SmsInitialize (vendor, release, newClientProc, managerData, - hostBasedAuthProc, errorLength, errorStringRet) - -char *vendor; -char *release; -SmsNewClientProc newClientProc; -SmPointer managerData; -IceHostBasedAuthProc hostBasedAuthProc; -int errorLength; -char *errorStringRet; - +SmsInitialize ( + char *vendor, + char *release, + SmsNewClientProc newClientProc, + SmPointer managerData, + IceHostBasedAuthProc hostBasedAuthProc, + int errorLength, + char *errorStringRet) { const char *auth_names[] = {"MIT-MAGIC-COOKIE-1"}; IcePaAuthProc auth_procs[] = {_IcePaMagicCookie1Proc}; @@ -186,10 +199,7 @@ char *errorStringRet; char * -SmsClientHostName (smsConn) - -SmsConn smsConn; - +SmsClientHostName (SmsConn smsConn) { return (IceGetPeerName (smsConn->iceConn)); } @@ -197,11 +207,9 @@ SmsConn smsConn; Status -SmsRegisterClientReply (smsConn, clientId) - -SmsConn smsConn; -char *clientId; - +SmsRegisterClientReply ( + SmsConn smsConn, + char *clientId) { IceConn iceConn = smsConn->iceConn; int extra; @@ -231,14 +239,12 @@ char *clientId; void -SmsSaveYourself (smsConn, saveType, shutdown, interactStyle, fast) - -SmsConn smsConn; -int saveType; -Bool shutdown; -int interactStyle; -Bool fast; - +SmsSaveYourself ( + SmsConn smsConn, + int saveType, + Bool shutdown, + int interactStyle, + Bool fast) { IceConn iceConn = smsConn->iceConn; smSaveYourselfMsg *pMsg; @@ -274,10 +280,7 @@ Bool fast; void -SmsSaveYourselfPhase2 (smsConn) - -SmsConn smsConn; - +SmsSaveYourselfPhase2 (SmsConn smsConn) { IceConn iceConn = smsConn->iceConn; @@ -288,10 +291,7 @@ SmsConn smsConn; void -SmsInteract (smsConn) - -SmsConn smsConn; - +SmsInteract (SmsConn smsConn) { IceConn iceConn = smsConn->iceConn; @@ -304,10 +304,7 @@ SmsConn smsConn; void -SmsDie (smsConn) - -SmsConn smsConn; - +SmsDie (SmsConn smsConn) { IceConn iceConn = smsConn->iceConn; @@ -318,10 +315,7 @@ SmsConn smsConn; void -SmsSaveComplete (smsConn) - -SmsConn smsConn; - +SmsSaveComplete (SmsConn smsConn) { IceConn iceConn = smsConn->iceConn; @@ -332,10 +326,7 @@ SmsConn smsConn; void -SmsShutdownCancelled (smsConn) - -SmsConn smsConn; - +SmsShutdownCancelled (SmsConn smsConn) { IceConn iceConn = smsConn->iceConn; @@ -348,12 +339,10 @@ SmsConn smsConn; void -SmsReturnProperties (smsConn, numProps, props) - -SmsConn smsConn; -int numProps; -SmProp **props; - +SmsReturnProperties ( + SmsConn smsConn, + int numProps, + SmProp **props) { IceConn iceConn = smsConn->iceConn; int bytes; @@ -378,10 +367,7 @@ SmProp **props; void -SmsCleanUp (smsConn) - -SmsConn smsConn; - +SmsCleanUp (SmsConn smsConn) { IceProtocolShutdown (smsConn->iceConn, _SmsOpcode); diff --git a/src/sm_misc.c b/src/sm_misc.c index 30c2c2d..bdd54de 100644 --- a/src/sm_misc.c +++ b/src/sm_misc.c @@ -42,10 +42,7 @@ in this Software without prior written authorization from The Open Group. */ void -SmFreeProperty (prop) - -SmProp *prop; - +SmFreeProperty (SmProp *prop) { if (prop) { @@ -73,11 +70,9 @@ SmProp *prop; */ void -SmFreeReasons (count, reasonMsgs) - -int count; -char **reasonMsgs; - +SmFreeReasons ( + int count, + char **reasonMsgs) { if (reasonMsgs) { @@ -97,30 +92,21 @@ char **reasonMsgs; */ int -SmcProtocolVersion (smcConn) - -SmcConn smcConn; - +SmcProtocolVersion (SmcConn smcConn) { return (smcConn->proto_major_version); } int -SmcProtocolRevision (smcConn) - -SmcConn smcConn; - +SmcProtocolRevision (SmcConn smcConn) { return (smcConn->proto_minor_version); } char * -SmcVendor (smcConn) - -SmcConn smcConn; - +SmcVendor (SmcConn smcConn) { char *string = (char *) malloc (strlen (smcConn->vendor) + 1); @@ -131,10 +117,7 @@ SmcConn smcConn; char * -SmcRelease (smcConn) - -SmcConn smcConn; - +SmcRelease (SmcConn smcConn) { char *string = (char *) malloc (strlen (smcConn->release) + 1); @@ -145,10 +128,7 @@ SmcConn smcConn; char * -SmcClientID (smcConn) - -SmcConn smcConn; - +SmcClientID (SmcConn smcConn) { char *clientId = (char *) malloc (strlen (smcConn->client_id) + 1); @@ -159,10 +139,7 @@ SmcConn smcConn; IceConn -SmcGetIceConnection (smcConn) - -SmcConn smcConn; - +SmcGetIceConnection (SmcConn smcConn) { return (smcConn->iceConn); } @@ -174,30 +151,21 @@ SmcConn smcConn; */ int -SmsProtocolVersion (smsConn) - -SmsConn smsConn; - +SmsProtocolVersion (SmsConn smsConn) { return (smsConn->proto_major_version); } int -SmsProtocolRevision (smsConn) - -SmsConn smsConn; - +SmsProtocolRevision (SmsConn smsConn) { return (smsConn->proto_minor_version); } char * -SmsClientID (smsConn) - -SmsConn smsConn; - +SmsClientID (SmsConn smsConn) { char *clientId = (char *) malloc (strlen (smsConn->client_id) + 1); @@ -208,10 +176,7 @@ SmsConn smsConn; IceConn -SmsGetIceConnection (smsConn) - -SmsConn smsConn; - +SmsGetIceConnection (SmsConn smsConn) { return (smsConn->iceConn); } diff --git a/src/sm_process.c b/src/sm_process.c index ab3ec0b..eb1605f 100644 --- a/src/sm_process.c +++ b/src/sm_process.c @@ -68,17 +68,14 @@ in this Software without prior written authorization from The Open Group. void -_SmcProcessMessage (iceConn, clientData, opcode, - length, swap, replyWait, replyReadyRet) - -IceConn iceConn; -IcePointer clientData; -int opcode; -unsigned long length; -Bool swap; -IceReplyWaitInfo *replyWait; -Bool *replyReadyRet; - +_SmcProcessMessage ( + IceConn iceConn, + IcePointer clientData, + int opcode, + unsigned long length, + Bool swap, + IceReplyWaitInfo *replyWait, + Bool *replyReadyRet) { SmcConn smcConn = (SmcConn) clientData; @@ -423,14 +420,12 @@ Bool *replyReadyRet; void -_SmsProcessMessage (iceConn, clientData, opcode, length, swap) - -IceConn iceConn; -IcePointer clientData; -int opcode; -unsigned long length; -Bool swap; - +_SmsProcessMessage ( + IceConn iceConn, + IcePointer clientData, + int opcode, + unsigned long length, + Bool swap) { SmsConn smsConn = (SmsConn) clientData; -- 1.5.4.3