aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os/io.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-10-07 08:23:46 +0200
committermarha <marha@users.sourceforge.net>2013-10-07 08:23:46 +0200
commit81fd17c8678e89cea6610b8b2996b028b21eb5dc (patch)
treed2c201976b3cd000658870071ab7b533359de039 /xorg-server/os/io.c
parent5593a3d2f370e3e12a043110bf2e395c938980d6 (diff)
downloadvcxsrv-81fd17c8678e89cea6610b8b2996b028b21eb5dc.tar.gz
vcxsrv-81fd17c8678e89cea6610b8b2996b028b21eb5dc.tar.bz2
vcxsrv-81fd17c8678e89cea6610b8b2996b028b21eb5dc.zip
xserver fontconfig libXdmcp mesa pixmand xkeyboard-config git update 7 oct 2013
xserver commit ccbe17b1c6da1ad9d085fc8133cdd15dc7004a4a xkeyboard-config commit c8326b7d12b20eccfd38d661b95d9b23d8a56e27 libXdmcp commit 089081dca4ba3598c6f9bf401c029378943b5854 pixman commit c89f4c826695dbb5df0817d84f845dbd3e28b7a7 fontconfig commit 604c2a683f1357fc65bad372b5d25a90099f827f mesa commit cfbfb50cb8d47b7f6975828b504936f9324f3b12
Diffstat (limited to 'xorg-server/os/io.c')
-rw-r--r--xorg-server/os/io.c63
1 files changed, 27 insertions, 36 deletions
diff --git a/xorg-server/os/io.c b/xorg-server/os/io.c
index 0d980ab9f..380036664 100644
--- a/xorg-server/os/io.c
+++ b/xorg-server/os/io.c
@@ -206,27 +206,17 @@ YieldControlDeath(void)
timesThisConnection = 0;
}
-int
-ReadRequestFromClient(ClientPtr client)
+/* If an input buffer was empty, either free it if it is too big or link it
+ * into our list of free input buffers. This means that different clients can
+ * share the same input buffer (at different times). This was done to save
+ * memory.
+ */
+static void
+NextAvailableInput(OsCommPtr oc)
{
- OsCommPtr oc = (OsCommPtr) client->osPrivate;
- ConnectionInputPtr oci = oc->input;
- int fd = oc->fd;
- unsigned int gotnow, needed;
- int result;
- register xReq *request;
- Bool need_header;
- Bool move_header;
-
- /* If an input buffer was empty, either free it if it is too big
- * or link it into our list of free input buffers. This means that
- * different clients can share the same input buffer (at different
- * times). This was done to save memory.
- */
-
if (AvailableInput) {
if (AvailableInput != oc) {
- register ConnectionInputPtr aci = AvailableInput->input;
+ ConnectionInputPtr aci = AvailableInput->input;
if (aci->size > BUFWATERMARK) {
free(aci->buffer);
@@ -236,10 +226,25 @@ ReadRequestFromClient(ClientPtr client)
aci->next = FreeInputs;
FreeInputs = aci;
}
- AvailableInput->input = (ConnectionInputPtr) NULL;
+ AvailableInput->input = NULL;
}
- AvailableInput = (OsCommPtr) NULL;
+ AvailableInput = NULL;
}
+}
+
+int
+ReadRequestFromClient(ClientPtr client)
+{
+ OsCommPtr oc = (OsCommPtr) client->osPrivate;
+ ConnectionInputPtr oci = oc->input;
+ int fd = oc->fd;
+ unsigned int gotnow, needed;
+ int result;
+ register xReq *request;
+ Bool need_header;
+ Bool move_header;
+
+ NextAvailableInput(oc);
/* make sure we have an input buffer */
@@ -494,22 +499,8 @@ InsertFakeRequest(ClientPtr client, char *data, int count)
int fd = oc->fd;
int gotnow, moveup;
- if (AvailableInput) {
- if (AvailableInput != oc) {
- ConnectionInputPtr aci = AvailableInput->input;
+ NextAvailableInput(oc);
- if (aci->size > BUFWATERMARK) {
- free(aci->buffer);
- free(aci);
- }
- else {
- aci->next = FreeInputs;
- FreeInputs = aci;
- }
- AvailableInput->input = (ConnectionInputPtr) NULL;
- }
- AvailableInput = (OsCommPtr) NULL;
- }
if (!oci) {
if ((oci = FreeInputs))
FreeInputs = oci->next;
@@ -814,7 +805,7 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
}
}
#endif
- if (oco->count + count + padBytes > oco->size) {
+ if (oco->count == 0 || oco->count + count + padBytes > oco->size) {
FD_CLR(oc->fd, &OutputPending);
if (!XFD_ANYSET(&OutputPending)) {
CriticalOutputPending = FALSE;