[PATCH libX11 2/4] Switch GetEmptyReq and GetResReq to call _XGetRequest

Peter Hutterer peter.hutterer at who-t.net
Wed Oct 26 21:21:26 PDT 2011


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
I just left this one as separate patch for easier reviewing, will squash in
with the 1/4  _XGetRequest patch before pushing.

 include/X11/Xlibint.h |   40 ++++++----------------------------------
 1 files changed, 6 insertions(+), 34 deletions(-)

diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
index 43d1f2a..01087b8 100644
--- a/include/X11/Xlibint.h
+++ b/include/X11/Xlibint.h
@@ -470,26 +470,12 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);
 
 #if !defined(UNIXCPP) || defined(ANSICPP)
 #define GetResReq(name, rid, req) \
-        WORD64ALIGN\
-	if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
-	    _XFlush(dpy);\
-	req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
-	req->reqType = X_##name;\
-	req->length = 2;\
-	req->id = (rid);\
-	dpy->bufptr += SIZEOF(xResourceReq);\
-	dpy->request++
+	req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \
+	req->id = (rid)
 #else
 #define GetResReq(name, rid, req) \
-        WORD64ALIGN\
-	if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
-	    _XFlush(dpy);\
-	req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
-	req->reqType = X_/**/name;\
-	req->length = 2;\
-	req->id = (rid);\
-	dpy->bufptr += SIZEOF(xResourceReq);\
-	dpy->request++
+	req = (xResourceReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xResourceReq)); \
+	req->id = (rid)
 #endif
 
 /*
@@ -498,24 +484,10 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);
  */
 #if !defined(UNIXCPP) || defined(ANSICPP)
 #define GetEmptyReq(name, req) \
-        WORD64ALIGN\
-	if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
-	    _XFlush(dpy);\
-	req = (xReq *) (dpy->last_req = dpy->bufptr);\
-	req->reqType = X_##name;\
-	req->length = 1;\
-	dpy->bufptr += SIZEOF(xReq);\
-	dpy->request++
+	req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq))
 #else
 #define GetEmptyReq(name, req) \
-        WORD64ALIGN\
-	if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
-	    _XFlush(dpy);\
-	req = (xReq *) (dpy->last_req = dpy->bufptr);\
-	req->reqType = X_/**/name;\
-	req->length = 1;\
-	dpy->bufptr += SIZEOF(xReq);\
-	dpy->request++
+	req = (xReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xReq))
 #endif
 
 #ifdef WORD64
-- 
1.7.7



More information about the xorg-devel mailing list