[PATCH] Save major/minor opcodes in ClientRec for RecordAReply

Keith Packard keithp at keithp.com
Tue Nov 8 11:05:07 PST 2011


On Tue, 8 Nov 2011 10:47:44 -0800, Jamey Sharp <jamey at minilop.net> wrote:

> I feel like this should turn into "if (client && client->requestBuffer)"
> rather than hiding the real condition inside the REQUEST macro.

I think that's a separate cleanup, and there are lots of such possible :-)

> > +    major = ((xReq *)client->requestBuffer)->reqType;
> > +    if (major < EXTENSION_BASE)
> > +	return 0;
> 
> GetExtensionEntry already checks that major is at least EXTENSION_BASE,
> so this test is redundant.

True; dunno whether we care about the cost of a function call for even
core requests though?

> And can I persuade you to just inline this directly into its only call
> site, below, in Dispatch? I don't think factoring it out enhances
> clarity in this case, especially since this way you need to look up the
> major opcode in both places.

Could use client->majorOp inside the function. In any case, it's a
static inline now, so one presumes the compiler would dtrt to some
degree?

Is it OK to remove the MinorOpcodeOfRequest function from the API?
Should it be preserved, but re-implemented using client->minorOp?

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20111108/0389af5d/attachment.pgp>


More information about the xorg-devel mailing list