[PATCH libX11] include: Add GetReqSized() for request buffers of specific size

Jamey Sharp jamey at minilop.net
Mon Oct 17 02:18:00 PDT 2011

On Mon, Oct 17, 2011 at 09:19:02AM +1000, Peter Hutterer wrote:
> On Fri, Oct 14, 2011 at 06:42:02PM +0200, Jamey Sharp wrote:
> > The GetReq family of macros is so evil. I'm not going to go so far as
> > to NAK this patch or anything, but please consider whether you can
> > implement this as a proper function or something. Perhaps:
> > 
> > void *XGetReq(CARD8 reqType, size_t sz);
> > 
> > (I think the other macros could be re-implemented on top of that
> > function, so long as the function continues to behave in a manner
> > compatible with code compiled using the current macros.)
> > 
> > Also, do you care about big-requests here? I can't remember how Xlib
> > handles that extension.
> fwiw, GetReqSized is more-or-less a copy of GetReqExtra with one parameter
> replaced. And GetReqExtra in turn is a copy of GetReq.

I certainly recognized the pattern. It's an awful pattern and I want it
to stop. :-)

> From a quick glance neither of them handle big-req directly.

If I had looked at the source, I'd have noticed that SetReqLen is
apparently the standard way to fix up a request to be a big-request,
after GetReq returns a standard one.

> I'll have a look at getting this to a function instead of a macro.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20111017/5015ea27/attachment.pgp>

More information about the xorg-devel mailing list