[PATCH:libxtrans 2/7] Add const qualifiers to TRANS(Open...) address args

Alan Coopersmith alan.coopersmith at oracle.com
Mon Aug 25 18:21:19 PDT 2014


Required also adding const to static TRANS(ParseAddress) function which
they pass the address arg to for parsing.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 Xtrans.c       |   13 +++++++------
 Xtrans.h       |    8 ++++----
 doc/xtrans.xml |    8 ++++----
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/Xtrans.c b/Xtrans.c
index ae8ffad..6fa5141 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -185,7 +185,8 @@ TRANS(SelectTransport) (const char *protocol)
 static
 #endif /* TEST_t */
 int
-TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
+TRANS(ParseAddress) (const char *address,
+                     char **protocol, char **host, char **port)
 
 {
     /*
@@ -391,7 +392,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
  */
 
 static XtransConnInfo
-TRANS(Open) (int type, char *address)
+TRANS(Open) (int type, const char *address)
 
 {
     char 		*protocol = NULL, *host = NULL, *port = NULL;
@@ -563,7 +564,7 @@ TRANS(Reopen) (int type, int trans_id, int fd, char *port)
 #ifdef TRANS_CLIENT
 
 XtransConnInfo
-TRANS(OpenCOTSClient) (char *address)
+TRANS(OpenCOTSClient) (const char *address)
 
 {
     prmsg (2,"OpenCOTSClient(%s)\n", address);
@@ -576,7 +577,7 @@ TRANS(OpenCOTSClient) (char *address)
 #ifdef TRANS_SERVER
 
 XtransConnInfo
-TRANS(OpenCOTSServer) (char *address)
+TRANS(OpenCOTSServer) (const char *address)
 
 {
     prmsg (2,"OpenCOTSServer(%s)\n", address);
@@ -589,7 +590,7 @@ TRANS(OpenCOTSServer) (char *address)
 #ifdef TRANS_CLIENT
 
 XtransConnInfo
-TRANS(OpenCLTSClient) (char *address)
+TRANS(OpenCLTSClient) (const char *address)
 
 {
     prmsg (2,"OpenCLTSClient(%s)\n", address);
@@ -602,7 +603,7 @@ TRANS(OpenCLTSClient) (char *address)
 #ifdef TRANS_SERVER
 
 XtransConnInfo
-TRANS(OpenCLTSServer) (char *address)
+TRANS(OpenCLTSServer) (const char *address)
 
 {
     prmsg (2,"OpenCLTSServer(%s)\n", address);
diff --git a/Xtrans.h b/Xtrans.h
index 5807b67..1fe0364 100644
--- a/Xtrans.h
+++ b/Xtrans.h
@@ -236,7 +236,7 @@ void TRANS(FreeConnInfo) (
 #ifdef TRANS_CLIENT
 
 XtransConnInfo TRANS(OpenCOTSClient)(
-    char *		/* address */
+    const char *	/* address */
 );
 
 #endif /* TRANS_CLIENT */
@@ -244,7 +244,7 @@ XtransConnInfo TRANS(OpenCOTSClient)(
 #ifdef TRANS_SERVER
 
 XtransConnInfo TRANS(OpenCOTSServer)(
-    char *		/* address */
+    const char *	/* address */
 );
 
 #endif /* TRANS_SERVER */
@@ -252,7 +252,7 @@ XtransConnInfo TRANS(OpenCOTSServer)(
 #ifdef TRANS_CLIENT
 
 XtransConnInfo TRANS(OpenCLTSClient)(
-    char *		/* address */
+    const char *	/* address */
 );
 
 #endif /* TRANS_CLIENT */
@@ -260,7 +260,7 @@ XtransConnInfo TRANS(OpenCLTSClient)(
 #ifdef TRANS_SERVER
 
 XtransConnInfo TRANS(OpenCLTSServer)(
-    char *		/* address */
+    const char *	/* address */
 );
 
 #endif /* TRANS_SERVER */
diff --git a/doc/xtrans.xml b/doc/xtrans.xml
index d89c247..5960dfa 100644
--- a/doc/xtrans.xml
+++ b/doc/xtrans.xml
@@ -393,7 +393,7 @@ errno will be available for debugging purposes.
     <funcsynopsis id='TRANSOpenCOTSClient'>
       <funcprototype>
         <funcdef>XtransConnInfo <function>TRANS(OpenCOTSClient)</function></funcdef>
-        <paramdef>char *<parameter>address</parameter></paramdef>
+        <paramdef>const char *<parameter>address</parameter></paramdef>
       </funcprototype>
     </funcsynopsis>
     <para>
@@ -408,7 +408,7 @@ success, or <constant>NULL</constant> on failure.
     <funcsynopsis id='TRANSOpenCOTSServer'>
       <funcprototype>
         <funcdef>XtransConnInfo <function>TRANS(OpenCOTSServer)</function></funcdef>
-        <paramdef>char *<parameter>address</parameter></paramdef>
+        <paramdef>const char *<parameter>address</parameter></paramdef>
       </funcprototype>
     </funcsynopsis>
     <para>
@@ -423,7 +423,7 @@ on failure.
     <funcsynopsis id='TRANSOpenCLTSClient'>
       <funcprototype>
         <funcdef>XtransConnInfo <function>TRANS(OpenCLTSClient)</function></funcdef>
-        <paramdef>char *<parameter>address</parameter></paramdef>
+        <paramdef>const char *<parameter>address</parameter></paramdef>
       </funcprototype>
     </funcsynopsis>
     <para>
@@ -438,7 +438,7 @@ function returns an opaque transport connection object on success, or
     <funcsynopsis id='TRANSOpenCLTSServer'>
       <funcprototype>
         <funcdef>XtransConnInfo <function>TRANS(OpenCLTSServer)</function></funcdef>
-        <paramdef>char *<parameter>address</parameter></paramdef>
+        <paramdef>const char *<parameter>address</parameter></paramdef>
       </funcprototype>
     </funcsynopsis>
     <para>
-- 
1.7.9.2



More information about the xorg-devel mailing list