[PATCH] 2/5 various cleanups

Warren Turkal <wt-3Q/uRndAOlBJm/[email protected]>
Newsgroups gmane.comp.freedesktop.xserver
Message-ID <[email protected]>
This is the first of 5 cleanup patches I have made. I don't think these
patches conflict, but it would be best to apply them in numerical order.

wt

This makes the big request extension always get built.

diff -Nru3 xserver-old/configure.ac xserver/configure.ac
--- xserver-old/configure.ac    2004-02-10 19:28:50.000000000 -0600
+++ xserver/configure.ac        2004-02-12 00:17:04.000000000 -0600
@@ -285,7 +285,6 @@
 AC_DEFINE(XTEST,1,[Support XTest extension])
 AC_DEFINE(XSYNC,1,[Support XSync extension])
 AC_DEFINE(XCMISC,1,[Support XCMisc extension])
-AC_DEFINE(BIGREQS,1,[Support BigRequests extension])
 AC_DEFINE(PIXPRIV,1,[Support pixmap privates])
 AC_DEFINE(XFIXES,1,[Support XFixes extension])
 EXTENSION_LIBS="$EXTENSION_LIBS "'$(top_builddir)/xfixes/libxfixes.a'
diff -Nru3 xserver-old/mi/miinitext.c xserver/mi/miinitext.c
--- xserver-old/mi/miinitext.c  2003-12-29 00:24:01.000000000 -0600
+++ xserver/mi/miinitext.c      2004-02-12 00:16:33.000000000 -0600
@@ -267,9 +267,7 @@
 #ifdef XTEST
     if (!noTestExtensions) XTestExtensionInit();
 #endif
-#ifdef BIGREQS
     BigReqExtensionInit();
-#endif
 #ifdef MITMISC
     MITMiscExtensionInit();
 #endif
diff -Nru3 xserver-old/os/io.c xserver/os/io.c
--- xserver-old/os/io.c 2003-12-02 01:11:47.000000000 -0600
+++ xserver/os/io.c     2004-02-12 00:14:58.000000000 -0600
@@ -119,13 +119,11 @@
 #define get_req_len(req,cli) ((cli)->swapped ? \
                              lswaps((req)->length) : (req)->length)
 
-#ifdef BIGREQS
 #include <X11/extensions/bigreqstr.h>
 
 #define get_big_req_len(req,cli) ((cli)->swapped ? \
                                  lswapl(((xBigReq *)(req))->length) : \
                                  ((xBigReq *)(req))->length)
-#endif
 
 #define MAX_TIMES_PER         10
 
@@ -222,9 +220,7 @@
     int result;
     register xReq *request;
     Bool need_header;
-#ifdef BIGREQS
     Bool move_header;
-#endif
 
     /* 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
@@ -273,9 +269,7 @@
     oci->bufptr += oci->lenLastReq;
 
     need_header = FALSE;
-#ifdef BIGREQS
     move_header = FALSE;
-#endif
     gotnow = oci->bufcnt + oci->buffer - oci->bufptr;
     if (gotnow < sizeof(xReq))
     {
@@ -292,7 +286,6 @@
         */
        request = (xReq *)oci->bufptr;
        needed = get_req_len(request, client);
-#ifdef BIGREQS
        if (!needed && client->big_requests)
        {
            /* It's a Big Request. */
@@ -306,7 +299,6 @@
            else
                needed = get_big_req_len(request, client);
        }
-#endif
        client->req_len = needed;
        needed <<= 2; /* needed is in bytes now */
     }
@@ -418,7 +410,6 @@
            /* We wanted an xReq, now we've gotten it. */
            request = (xReq *)oci->bufptr;
            needed = get_req_len(request, client);
-#ifdef BIGREQS
            if (!needed && client->big_requests)
            {
                move_header = TRUE;
@@ -427,7 +418,6 @@
                else
                    needed = get_big_req_len(request, client);
            }
-#endif
            client->req_len = needed;
            needed <<= 2;
        }
@@ -440,11 +430,9 @@
     }
     if (needed == 0)
     {
-#ifdef BIGREQS
        if (client->big_requests)
            needed = sizeof(xBigReq);
        else
-#endif
            needed = sizeof(xReq);
     }
     oci->lenLastReq = needed;
@@ -462,12 +450,10 @@
     {
        request = (xReq *)(oci->bufptr + needed);
        if (gotnow >= (result = (get_req_len(request, client) << 2))
-#ifdef BIGREQS
            && (result ||
                (client->big_requests &&
                 (gotnow >= sizeof(xBigReq) &&
                  gotnow >= (get_big_req_len(request, client) << 2))))
-#endif
            )
            FD_SET(fd, &ClientsWithInput);
        else
@@ -496,7 +482,6 @@
 #endif
     if (++timesThisConnection >= MAX_TIMES_PER)
        YieldControl();
-#ifdef BIGREQS
     if (move_header)
     {
        request = (xReq *)oci->bufptr;
@@ -505,7 +490,6 @@
        oci->lenLastReq -= (sizeof(xBigReq) - sizeof(xReq));
        client->req_len -= (sizeof(xBigReq) - sizeof(xReq)) >> 2;
     }
-#endif
     client->requestBuffer = (pointer)oci->bufptr;
 #ifdef DEBUG_COMMUNICATION
     {
@@ -629,7 +613,6 @@
     {
        request = (xReq *)oci->bufptr;
        needed = get_req_len(request, client);
-#ifdef BIGREQS
        if (!needed && client->big_requests)
        {
            oci->bufptr -= sizeof(xBigReq) - sizeof(xReq);
@@ -641,7 +624,6 @@
                swapl(&((xBigReq *)oci->bufptr)->length, n);
            }
        }
-#endif
        if (gotnow >= (needed << 2))
        {
            if (FD_ISSET(fd, &AllClients))
@@ -702,9 +684,7 @@
     {
        /* caller wants the request after the one specified by req */
        reqlen = get_req_len(req, client);
-#ifdef BIGREQS
        if (!reqlen) reqlen = get_big_req_len(req, client);
-#endif
        pnextreq = (xReqPtr)(((char *)req) + (reqlen << 2));
     }
 
@@ -716,7 +696,6 @@
        return NULL;
 
     needed = get_req_len(pnextreq, client) << 2;
-#ifdef BIGREQS
     if (!needed)
     {
        /* it's a big request */
@@ -724,7 +703,6 @@
            return NULL;
        needed = get_big_req_len(pnextreq, client) << 2;
     }
-#endif
 
     /* if we have less than we need, return NULL */
 
@@ -769,9 +747,7 @@
     /* twiddle the oci to skip over the requests */
 
     reqlen = get_req_len(req, client);
-#ifdef BIGREQS
     if (!reqlen) reqlen = get_big_req_len(req, client);
-#endif
     reqlen <<= 2;
     oci->bufptr = (char *)req;
     oci->lenLastReq = reqlen;

-- 
Warren Turkal
President, GOLUM, Inc.
http://www.golum.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.