[PATCH libxtrans 3/3] Use 'const char *' for port names in reopen functions.
Keith Packard
keithp at keithp.com
Wed Jan 29 12:54:27 PST 2014
The font server wants to provide a constant string (most often "0")
for the port name, so just change the argument type to allow that
without generating warnings. Nothing in Xtrans relied on being able to
write this value, so this "shouldn't" cause any additional compiler
errors or warnings with other users (and, in fact, both the X server
and libX11 compile just fine with this change).
Signed-off-by: Keith Packard <keithp at keithp.com>
---
Xtrans.c | 6 +++---
Xtrans.h | 4 ++--
Xtransint.h | 4 ++--
Xtranslcl.c | 8 ++++----
Xtranssock.c | 8 ++++----
5 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/Xtrans.c b/Xtrans.c
index 735d7b8..bef974d 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -484,7 +484,7 @@ TRANS(Open) (int type, char *address)
*/
static XtransConnInfo
-TRANS(Reopen) (int type, int trans_id, int fd, char *port)
+TRANS(Reopen) (int type, int trans_id, int fd, const char *port)
{
XtransConnInfo ciptr = NULL;
@@ -610,7 +610,7 @@ TRANS(OpenCLTSServer) (char *address)
#ifdef TRANS_REOPEN
XtransConnInfo
-TRANS(ReopenCOTSServer) (int trans_id, int fd, char *port)
+TRANS(ReopenCOTSServer) (int trans_id, int fd, const char *port)
{
prmsg (2,"ReopenCOTSServer(%d, %d, %s)\n", trans_id, fd, port);
@@ -618,7 +618,7 @@ TRANS(ReopenCOTSServer) (int trans_id, int fd, char *port)
}
XtransConnInfo
-TRANS(ReopenCLTSServer) (int trans_id, int fd, char *port)
+TRANS(ReopenCLTSServer) (int trans_id, int fd, const char *port)
{
prmsg (2,"ReopenCLTSServer(%d, %d, %s)\n", trans_id, fd, port);
diff --git a/Xtrans.h b/Xtrans.h
index 69accd7..cfbee75 100644
--- a/Xtrans.h
+++ b/Xtrans.h
@@ -270,13 +270,13 @@ XtransConnInfo TRANS(OpenCLTSServer)(
XtransConnInfo TRANS(ReopenCOTSServer)(
int, /* trans_id */
int, /* fd */
- char * /* port */
+ const char * /* port */
);
XtransConnInfo TRANS(ReopenCLTSServer)(
int, /* trans_id */
int, /* fd */
- char * /* port */
+ const char * /* port */
);
int TRANS(GetReopenInfo)(
diff --git a/Xtransint.h b/Xtransint.h
index b910eaa..aaf0b52 100644
--- a/Xtransint.h
+++ b/Xtransint.h
@@ -209,13 +209,13 @@ typedef struct _Xtransport {
XtransConnInfo (*ReopenCOTSServer)(
struct _Xtransport *, /* transport */
int, /* fd */
- char * /* port */
+ const char * /* port */
);
XtransConnInfo (*ReopenCLTSServer)(
struct _Xtransport *, /* transport */
int, /* fd */
- char * /* port */
+ const char * /* port */
);
#endif /* TRANS_REOPEN */
diff --git a/Xtranslcl.c b/Xtranslcl.c
index 4deb86c..d3d62ce 100644
--- a/Xtranslcl.c
+++ b/Xtranslcl.c
@@ -132,7 +132,7 @@ TRANS(OpenFail)(XtransConnInfo ciptr _X_UNUSED, char *port _X_UNUSED)
#ifdef TRANS_REOPEN
static int
-TRANS(ReopenFail)(XtransConnInfo ciptr _X_UNUSED, int fd _X_UNUSED, char *port _X_UNUSED)
+TRANS(ReopenFail)(XtransConnInfo ciptr _X_UNUSED, int fd _X_UNUSED, const char *port _X_UNUSED)
{
return 0;
@@ -1276,7 +1276,7 @@ TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
#ifdef LOCAL_TRANS_PTS
static int
-TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, char *port)
+TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, const char *port)
{
#ifdef PTSNODENAME
@@ -1317,7 +1317,7 @@ TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, char *port)
#ifdef LOCAL_TRANS_NAMED
static int
-TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd _X_UNUSED, char *port)
+TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd _X_UNUSED, const char *port)
{
#ifdef NAMEDNODENAME
@@ -1358,7 +1358,7 @@ TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd _X_UNUSED, char *port)
#ifdef LOCAL_TRANS_SCO
static int
-TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, char *port)
+TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, const char *port)
{
#ifdef SCORNODENAME
diff --git a/Xtranssock.c b/Xtranssock.c
index ed32f47..867805c 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -204,7 +204,7 @@ static Sockettrans2dev Sockettrans2devtab[] = {
static int TRANS(SocketINETClose) (XtransConnInfo ciptr);
#endif
-#if defined(TCPCONN) || defined(TRANS_REOPEN)
+#if (defined(TCPCONN) && defined(TRANS_SERVER)) || defined(TRANS_REOPEN)
static int
is_numeric (const char *str)
{
@@ -466,7 +466,7 @@ TRANS(SocketOpen) (int i, int type)
#ifdef TRANS_REOPEN
static XtransConnInfo
-TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, char *port)
+TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, const char *port)
{
XtransConnInfo ciptr;
@@ -755,7 +755,7 @@ TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, char *protocol,
#ifdef TRANS_REOPEN
static XtransConnInfo
-TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, char *port)
+TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, const char *port)
{
XtransConnInfo ciptr;
@@ -789,7 +789,7 @@ TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, char *port)
}
static XtransConnInfo
-TRANS(SocketReopenCLTSServer) (Xtransport *thistrans, int fd, char *port)
+TRANS(SocketReopenCLTSServer) (Xtransport *thistrans, int fd, const char *port)
{
XtransConnInfo ciptr;
--
1.8.5.3
More information about the xorg-devel
mailing list