From 17491de45c352c833442cccf17a9bd65909889db Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 23 Aug 2014 12:28:14 -0700 Subject: Add const qualifiers to TRANS(OpenC{L,O}TS{Server,Client}) args Signed-off-by: Alan Coopersmith --- Xtransint.h | 24 ++++++++++++------------ Xtranslcl.c | 49 ++++++++++++++++++++++++++----------------------- Xtranssock.c | 16 ++++++++-------- doc/xtrans.xml | 56 ++++++++++++++++++++++++++++---------------------------- 4 files changed, 74 insertions(+), 71 deletions(-) diff --git a/Xtransint.h b/Xtransint.h index f674e5b..5ff824d 100644 --- a/Xtransint.h +++ b/Xtransint.h @@ -163,9 +163,9 @@ typedef struct _Xtransport { XtransConnInfo (*OpenCOTSClient)( struct _Xtransport *, /* transport */ - char *, /* protocol */ - char *, /* host */ - char * /* port */ + const char *, /* protocol */ + const char *, /* host */ + const char * /* port */ ); #endif /* TRANS_CLIENT */ @@ -174,9 +174,9 @@ typedef struct _Xtransport { const char ** nolisten; XtransConnInfo (*OpenCOTSServer)( struct _Xtransport *, /* transport */ - char *, /* protocol */ - char *, /* host */ - char * /* port */ + const char *, /* protocol */ + const char *, /* host */ + const char * /* port */ ); #endif /* TRANS_SERVER */ @@ -185,9 +185,9 @@ typedef struct _Xtransport { XtransConnInfo (*OpenCLTSClient)( struct _Xtransport *, /* transport */ - char *, /* protocol */ - char *, /* host */ - char * /* port */ + const char *, /* protocol */ + const char *, /* host */ + const char * /* port */ ); #endif /* TRANS_CLIENT */ @@ -196,9 +196,9 @@ typedef struct _Xtransport { XtransConnInfo (*OpenCLTSServer)( struct _Xtransport *, /* transport */ - char *, /* protocol */ - char *, /* host */ - char * /* port */ + const char *, /* protocol */ + const char *, /* host */ + const char * /* port */ ); #endif /* TRANS_SERVER */ diff --git a/Xtranslcl.c b/Xtranslcl.c index 4f04927..3217506 100644 --- a/Xtranslcl.c +++ b/Xtranslcl.c @@ -123,7 +123,7 @@ static int TRANS(LocalClose)(XtransConnInfo ciptr); /* Type Not Supported */ static int -TRANS(OpenFail)(XtransConnInfo ciptr _X_UNUSED, char *port _X_UNUSED) +TRANS(OpenFail)(XtransConnInfo ciptr _X_UNUSED, const char *port _X_UNUSED) { return -1; @@ -159,7 +159,8 @@ TRANS(LocalSendFdInvalid)(XtransConnInfo ciptr, int fd, int do_close) static int -TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path) +TRANS(FillAddrInfo)(XtransConnInfo ciptr, + const char *sun_path, const char *peer_sun_path) { struct sockaddr_un *sunaddr; @@ -317,7 +318,7 @@ static void _dummy(int sig _X_UNUSED) #ifdef TRANS_CLIENT static int -TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port) +TRANS(PTSOpenClient)(XtransConnInfo ciptr, const char *port) { #ifdef PTSNODENAME @@ -469,7 +470,7 @@ TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port) #ifdef TRANS_SERVER static int -TRANS(PTSOpenServer)(XtransConnInfo ciptr, char *port) +TRANS(PTSOpenServer)(XtransConnInfo ciptr, const char *port) { #ifdef PTSNODENAME @@ -670,7 +671,7 @@ TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) #ifdef TRANS_CLIENT static int -TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, char *port) +TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, const char *port) { #ifdef NAMEDNODENAME @@ -807,7 +808,7 @@ TRANS(NAMEDOpenPipe)(const char *server_path) #endif static int -TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, char *port) +TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, const char *port) { #ifdef NAMEDNODENAME int fd; @@ -1013,7 +1014,7 @@ named_spipe(int fd, char *path) #ifdef TRANS_CLIENT static int -TRANS(SCOOpenClient)(XtransConnInfo ciptr, char *port) +TRANS(SCOOpenClient)(XtransConnInfo ciptr, const char *port) { #ifdef SCORNODENAME int fd, server, fl, ret; @@ -1101,7 +1102,7 @@ TRANS(SCOOpenClient)(XtransConnInfo ciptr, char *port) #ifdef TRANS_SERVER static int -TRANS(SCOOpenServer)(XtransConnInfo ciptr, char *port) +TRANS(SCOOpenServer)(XtransConnInfo ciptr, const char *port) { #ifdef SCORNODENAME char serverR_path[64]; @@ -1408,7 +1409,7 @@ typedef struct _LOCALtrans2dev { #ifdef TRANS_CLIENT int (*devcotsopenclient)( - XtransConnInfo, char * /*port*/ + XtransConnInfo, const char * /*port*/ ); #endif /* TRANS_CLIENT */ @@ -1416,7 +1417,7 @@ typedef struct _LOCALtrans2dev { #ifdef TRANS_SERVER int (*devcotsopenserver)( - XtransConnInfo, char * /*port*/ + XtransConnInfo, const char * /*port*/ ); #endif /* TRANS_SERVER */ @@ -1424,7 +1425,7 @@ typedef struct _LOCALtrans2dev { #ifdef TRANS_CLIENT int (*devcltsopenclient)( - XtransConnInfo, char * /*port*/ + XtransConnInfo, const char * /*port*/ ); #endif /* TRANS_CLIENT */ @@ -1432,7 +1433,7 @@ typedef struct _LOCALtrans2dev { #ifdef TRANS_SERVER int (*devcltsopenserver)( - XtransConnInfo, char * /*port*/ + XtransConnInfo, const char * /*port*/ ); #endif /* TRANS_SERVER */ @@ -1758,7 +1759,7 @@ TRANS(LocalGetNextTransport)(void) */ static int -HostReallyLocal (char *host) +HostReallyLocal (const char *host) { /* @@ -1788,7 +1789,8 @@ HostReallyLocal (char *host) static XtransConnInfo -TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port) +TRANS(LocalOpenClient)(int type, const char *protocol, + const char *host, const char *port) { LOCALtrans2dev *transptr; @@ -1883,7 +1885,8 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port) #ifdef TRANS_SERVER static XtransConnInfo -TRANS(LocalOpenServer)(int type, char *protocol, char *host _X_UNUSED, char *port) +TRANS(LocalOpenServer)(int type, const char *protocol, + const char *host _X_UNUSED, const char *port) { int i; @@ -1998,8 +2001,8 @@ TRANS(LocalReopenServer)(int type, int index, int fd, const char *port) #ifdef TRANS_CLIENT static XtransConnInfo -TRANS(LocalOpenCOTSClient)(Xtransport *thistrans _X_UNUSED, char *protocol, - char *host, char *port) +TRANS(LocalOpenCOTSClient)(Xtransport *thistrans _X_UNUSED, const char *protocol, + const char *host, const char *port) { prmsg(2,"LocalOpenCOTSClient(%s,%s,%s)\n",protocol,host,port); @@ -2013,8 +2016,8 @@ TRANS(LocalOpenCOTSClient)(Xtransport *thistrans _X_UNUSED, char *protocol, #ifdef TRANS_SERVER static XtransConnInfo -TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol, - char *host, char *port) +TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, const char *protocol, + const char *host, const char *port) { char *typetocheck = NULL; @@ -2057,8 +2060,8 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol, #ifdef TRANS_CLIENT static XtransConnInfo -TRANS(LocalOpenCLTSClient)(Xtransport *thistrans _X_UNUSED, char *protocol, - char *host, char *port) +TRANS(LocalOpenCLTSClient)(Xtransport *thistrans _X_UNUSED, const char *protocol, + const char *host, const char *port) { prmsg(2,"LocalOpenCLTSClient(%s,%s,%s)\n",protocol,host,port); @@ -2072,8 +2075,8 @@ TRANS(LocalOpenCLTSClient)(Xtransport *thistrans _X_UNUSED, char *protocol, #ifdef TRANS_SERVER static XtransConnInfo -TRANS(LocalOpenCLTSServer)(Xtransport *thistrans _X_UNUSED, char *protocol, - char *host, char *port) +TRANS(LocalOpenCLTSServer)(Xtransport *thistrans _X_UNUSED, const char *protocol, + const char *host, const char *port) { prmsg(2,"LocalOpenCLTSServer(%s,%s,%s)\n",protocol,host,port); diff --git a/Xtranssock.c b/Xtranssock.c index 65ffa6f..d830e7c 100644 --- a/Xtranssock.c +++ b/Xtranssock.c @@ -596,8 +596,8 @@ TRANS(SocketOpenCOTSClientBase) (const char *transname, const char *protocol, } static XtransConnInfo -TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, char *protocol, - char *host, char *port) +TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, const char *protocol, + const char *host, const char *port) { return TRANS(SocketOpenCOTSClientBase)( thistrans->TransName, protocol, host, port, -1); @@ -610,8 +610,8 @@ TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, char *protocol, #ifdef TRANS_SERVER static XtransConnInfo -TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol, - char *host, char *port) +TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, const char *protocol, + const char *host, const char *port) { XtransConnInfo ciptr; @@ -677,8 +677,8 @@ TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol, #ifdef TRANS_CLIENT static XtransConnInfo -TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol, - char *host, char *port) +TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, const char *protocol, + const char *host, const char *port) { XtransConnInfo ciptr; @@ -716,8 +716,8 @@ TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol, #ifdef TRANS_SERVER static XtransConnInfo -TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, char *protocol, - char *host, char *port) +TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, const char *protocol, + const char *host, const char *port) { XtransConnInfo ciptr; diff --git a/doc/xtrans.xml b/doc/xtrans.xml index 10e5489..e3bc1c9 100644 --- a/doc/xtrans.xml +++ b/doc/xtrans.xml @@ -191,31 +191,31 @@ typedef struct _Xtransport { int flags; XtransConnInfo (*OpenCOTSClient)( - struct _Xtransport *, /* transport */ - char *, /* protocol */ - char *, /* host */ - char * /* port */ + struct _Xtransport *, /* transport */ + const char *, /* protocol */ + const char *, /* host */ + const char * /* port */ ); XtransConnInfo (*OpenCOTSServer)( - struct _Xtransport *, /* transport */ - char *, /* protocol */ - char *, /* host */ - char * /* port */ + struct _Xtransport *, /* transport */ + const char *, /* protocol */ + const char *, /* host */ + const char * /* port */ ); XtransConnInfo (*OpenCLTSClient)( - struct _Xtransport *, /* transport */ - char *, /* protocol */ - char *, /* host */ - char * /* port */ + struct _Xtransport *, /* transport */ + const char *, /* protocol */ + const char *, /* host */ + const char * /* port */ ); XtransConnInfo (*OpenCLTSServer)( - struct _Xtransport *, /* transport */ - char *, /* protocol */ - char *, /* host */ - char * /* port */ + struct _Xtransport *, /* transport */ + const char *, /* protocol */ + const char *, /* host */ + const char * /* port */ ); int (*SetOption)( @@ -826,9 +826,9 @@ the #ifdef SUNSYSV should be handled inside these functions. XtransConnInfo *OpenCOTSClient struct _Xtransport *thistrans - char *protocol - char *host - char *port + const char *protocol + const char *host + const char *port @@ -850,9 +850,9 @@ this function. XtransConnInfo *OpenCOTSServer struct _Xtransport *thistrans - char *protocol - char *host - char *port + const char *protocol + const char *host + const char *port @@ -872,9 +872,9 @@ will open the transport. XtransConnInfo *OpenCLTSClient struct _Xtransport *thistrans - char *protocol - char *host - char *port + const char *protocol + const char *host + const char *port @@ -896,9 +896,9 @@ in by this function. XtransConnInfo *OpenCLTSServer struct _Xtransport *thistrans - char *protocol - char *host - char *port + const char *protocol + const char *host + const char *port -- cgit v1.2.3