libxtrans: [PATCH] Move static function declarations from Xtransint.h to transport.c.

Jamey Sharp jamey at minilop.net
Fri Oct 2 11:17:34 PDT 2009


The xserver source uses type declarations and #defines from Xtransint.h in
source files where the rest of the Xtrans source is not included. These
static function declarations result in warnings on GCC when the function
body isn't subsequently provided. Moving the prototypes out of the header
files eliminates the warning.

Commit 300893171ca7ad684472e5961a7b2ba0eb291f6b explains why the
prototypes can't simply be removed, which was previously tried as a fix in
commit d192bac409fe5ef99fa9fb9b5a0d5f656f0f1412. That earlier attempt
wouldn't have completely solved the problem for systems with broken or
missing readv/writev anyway.

It might be better to stop including Xtransint.h from anywhere outside
transport.c--perhaps even moving all of Xtransint.h into transport.c--but
then the X server would need new API from Xtrans. This patch, by contrast,
keeps the changes self-contained in libxtrans and API-compatible with
other versions.

Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
 Xtransint.h |   50 --------------------------------------------------
 transport.c |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/Xtransint.h b/Xtransint.h
index cd5b64f..827463b 100644
--- a/Xtransint.h
+++ b/Xtransint.h
@@ -308,56 +308,6 @@ typedef struct _Xtransport_table {
 #define TRANS_KEEPFLAGS	(TRANS_NOUNLINK|TRANS_ABSTRACT)
 
 /*
- * readv() and writev() don't exist or don't work correctly on some
- * systems, so they may be emulated.
- */
-
-#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32) 
-
-#define READV(ciptr, iov, iovcnt)	TRANS(ReadV)(ciptr, iov, iovcnt)
-
-static	int TRANS(ReadV)(
-    XtransConnInfo,	/* ciptr */
-    struct iovec *,	/* iov */
-    int			/* iovcnt */
-);
-
-#else
-
-#define READV(ciptr, iov, iovcnt)	readv(ciptr->fd, iov, iovcnt)
-
-#endif /* CRAY || (SYSV && __i386__) || WIN32 || __sxg__ || */
-
-
-#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32) 
-
-#define WRITEV(ciptr, iov, iovcnt)	TRANS(WriteV)(ciptr, iov, iovcnt)
-
-static int TRANS(WriteV)(
-    XtransConnInfo,	/* ciptr */
-    struct iovec *,	/* iov */
-    int 		/* iovcnt */
-);
-
-#else
-
-#define WRITEV(ciptr, iov, iovcnt)	writev(ciptr->fd, iov, iovcnt)
-
-#endif /* CRAY || WIN32 || __sxg__ */
-
-
-static int is_numeric (
-    const char *	/* str */
-);
-
-#ifdef TRANS_SERVER
-static int trans_mkdir (
-    const char *,	/* path */
-    int			/* mode */
-);
-#endif
-
-/*
  * Some XTRANSDEBUG stuff
  */
 
diff --git a/transport.c b/transport.c
index 5131d99..155b3fa 100644
--- a/transport.c
+++ b/transport.c
@@ -60,6 +60,56 @@ from The Open Group.
 
 #include "Xtransint.h"
 
+/*
+ * readv() and writev() don't exist or don't work correctly on some
+ * systems, so they may be emulated.
+ */
+
+#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32) 
+
+#define READV(ciptr, iov, iovcnt)	TRANS(ReadV)(ciptr, iov, iovcnt)
+
+static	int TRANS(ReadV)(
+    XtransConnInfo,	/* ciptr */
+    struct iovec *,	/* iov */
+    int			/* iovcnt */
+);
+
+#else
+
+#define READV(ciptr, iov, iovcnt)	readv(ciptr->fd, iov, iovcnt)
+
+#endif /* CRAY || (SYSV && __i386__) || WIN32 || __sxg__ || */
+
+
+#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32) 
+
+#define WRITEV(ciptr, iov, iovcnt)	TRANS(WriteV)(ciptr, iov, iovcnt)
+
+static int TRANS(WriteV)(
+    XtransConnInfo,	/* ciptr */
+    struct iovec *,	/* iov */
+    int 		/* iovcnt */
+);
+
+#else
+
+#define WRITEV(ciptr, iov, iovcnt)	writev(ciptr->fd, iov, iovcnt)
+
+#endif /* CRAY || WIN32 || __sxg__ */
+
+
+static int is_numeric (
+    const char *	/* str */
+);
+
+#ifdef TRANS_SERVER
+static int trans_mkdir (
+    const char *,	/* path */
+    int			/* mode */
+);
+#endif
+
 #ifdef LOCALCONN
 #include "Xtranslcl.c"
 #endif
-- 
1.6.3.3



More information about the xorg-devel mailing list