[PATCH libX11 4/4] Use GetReqSized for GetReq and GetReqExtra

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


GetEmptyReq and GetResReq cannot do this due to the final typecast -
typically requests that need either of those do not have their own typedef
in the protocol headers.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 include/X11/Xlibint.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
index 9d75d06..80edeec 100644
--- a/include/X11/Xlibint.h
+++ b/include/X11/Xlibint.h
@@ -456,10 +456,10 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);
 
 #if !defined(UNIXCPP) || defined(ANSICPP)
 #define GetReq(name, req) \
-	req = (x##name##Req *) _XGetRequest(dpy, X_##name, SIZEOF(x##name##Req))
+	GetReqSized(name, SIZEOF(x##name##Req), req)
 #else  /* non-ANSI C uses empty comment instead of "##" for token concatenation */
 #define GetReq(name, req) \
-	req = (x/**/name/**/Req *) _XGetRequest(dpy, X_/**/name, SIZEOF(x/**/name/**/Req))
+	GetReqSized(name, SIZEOF(x/**/name/**/Req), req)
 #endif
 
 /* GetReqExtra is the same as GetReq, but allocates "n" additional
@@ -467,10 +467,10 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);
 
 #if !defined(UNIXCPP) || defined(ANSICPP)
 #define GetReqExtra(name, n, req) \
-	req = (x##name##Req *) _XGetRequest(dpy, X_##name, SIZEOF(x##name##Req) + n)
+        GetReqSized(name, SIZEOF(x##name##Req) + n, req)
 #else
 #define GetReqExtra(name, n, req) \
-	req = (x/**/name/**/Req *) _XGetRequest(dpy, X_/**/name, SIZEOF(x/**/name/**/Req) + n)
+        GetReqSized(name, SIZEOF(x/**/name/**/Req) + n, req)
 #endif
 
 
-- 
1.7.7



More information about the xorg-devel mailing list