[PATCH 6/7] os: Hide the Connection{In, Out}put implementation details

Adam Jackson ajax at redhat.com
Thu Sep 20 13:56:07 PDT 2012


Reviewed-by: Daniel Stone <daniel at fooishbar.org>
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 os/connection.c |    4 ++--
 os/io.c         |   21 +++++++++++++++++++--
 os/osdep.h      |   18 ++----------------
 3 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/os/connection.c b/os/connection.c
index 4561caa..6cd8bcf 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -1038,8 +1038,8 @@ CloseDownConnection(ClientPtr client)
     if (FlushCallback)
         CallCallbacks(&FlushCallback, NULL);
 
-    if (oc->output && oc->output->count)
-        FlushClient(client, oc, (char *) NULL, 0);
+    if (oc->output)
+	FlushClient(client, oc, (char *) NULL, 0);
 #ifdef XDMCP
     XdmcpCloseDisplay(oc->fd);
 #endif
diff --git a/os/io.c b/os/io.c
index e44db39..015f137 100644
--- a/os/io.c
+++ b/os/io.c
@@ -82,6 +82,23 @@ SOFTWARE.
 CallbackListPtr ReplyCallback;
 CallbackListPtr FlushCallback;
 
+typedef struct _connectionInput {
+    struct _connectionInput *next;
+    char *buffer;               /* contains current client input */
+    char *bufptr;               /* pointer to current start of data */
+    int bufcnt;                 /* count of bytes in buffer */
+    int lenLastReq;
+    int size;
+    unsigned int ignoreBytes;   /* bytes to ignore before the next request */
+} ConnectionInput, *ConnectionInputPtr;
+
+typedef struct _connectionOutput {
+    struct _connectionOutput *next;
+    unsigned char *buf;
+    int size;
+    int count;
+} ConnectionOutput, *ConnectionOutputPtr;
+
 static ConnectionInputPtr AllocateInputBuffer(void);
 static ConnectionOutputPtr AllocateOutputBuffer(void);
 
@@ -845,8 +862,8 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
     long notWritten;
     long todo;
 
-    if (!oco)
-        return 0;
+    if (!oco || !oco->count)
+	return 0;
     written = 0;
     padsize = padding_for_int32(extraCount);
     notWritten = oco->count + extraCount + padsize;
diff --git a/os/osdep.h b/os/osdep.h
index 55db16f..0ccdb62 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -107,22 +107,8 @@ typedef Bool (*AddAuthorFunc) (unsigned name_length, const char *name,
                                unsigned data_length, char *data);
 #endif
 
-typedef struct _connectionInput {
-    struct _connectionInput *next;
-    char *buffer;               /* contains current client input */
-    char *bufptr;               /* pointer to current start of data */
-    int bufcnt;                 /* count of bytes in buffer */
-    int lenLastReq;
-    int size;
-    unsigned int ignoreBytes;   /* bytes to ignore before the next request */
-} ConnectionInput, *ConnectionInputPtr;
-
-typedef struct _connectionOutput {
-    struct _connectionOutput *next;
-    unsigned char *buf;
-    int size;
-    int count;
-} ConnectionOutput, *ConnectionOutputPtr;
+typedef struct _connectionInput *ConnectionInputPtr;
+typedef struct _connectionOutput *ConnectionOutputPtr;
 
 struct _osComm;
 
-- 
1.7.7.6



More information about the xorg-devel mailing list