[PATCH libxtrans 1/3] move is_numeric to Xtranssock.c and only define for TCPCONN or TRANS_REOPEN

Keith Packard keithp at keithp.com
Wed Jan 29 12:54:25 PST 2014


Don't define this function unless it is actually going to be used.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 Xtransint.h  |  5 -----
 Xtranssock.c | 14 ++++++++++++++
 Xtransutil.c | 12 ------------
 3 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/Xtransint.h b/Xtransint.h
index ec5a772..6fc2811 100644
--- a/Xtransint.h
+++ b/Xtransint.h
@@ -382,11 +382,6 @@ static int TRANS(WriteV)(
 
 #endif /* CRAY || WIN32 || __sxg__ */
 
-
-static int is_numeric (
-    const char *	/* str */
-);
-
 #ifdef TRANS_SERVER
 static int trans_mkdir (
     const char *,	/* path */
diff --git a/Xtranssock.c b/Xtranssock.c
index fdf1dd7..ed32f47 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -204,6 +204,20 @@ static Sockettrans2dev Sockettrans2devtab[] = {
 static int TRANS(SocketINETClose) (XtransConnInfo ciptr);
 #endif
 
+#if defined(TCPCONN) || defined(TRANS_REOPEN)
+static int
+is_numeric (const char *str)
+{
+    int i;
+
+    for (i = 0; i < (int) strlen (str); i++)
+	if (!isdigit (str[i]))
+	    return (0);
+
+    return (1);
+}
+#endif
+
 #ifdef UNIXCONN
 
 
diff --git a/Xtransutil.c b/Xtransutil.c
index 63f0fc3..63d22b0 100644
--- a/Xtransutil.c
+++ b/Xtransutil.c
@@ -434,18 +434,6 @@ TRANS(WSAStartup) (void)
 
 #include <ctype.h>
 
-static int
-is_numeric (const char *str)
-{
-    int i;
-
-    for (i = 0; i < (int) strlen (str); i++)
-	if (!isdigit (str[i]))
-	    return (0);
-
-    return (1);
-}
-
 #ifdef TRANS_SERVER
 #include <sys/types.h>
 #include <sys/stat.h>
-- 
1.8.5.3



More information about the xorg-devel mailing list