Peter Hutterer <[email protected]> writes:

> as keith already pointed out, this will break for generic events. but you
> can still get the same effect by switching to
>    unsigned char buffer[eventlength];
>    xEvent *swapped = buffer;
> and get rid of the heap allocation this way.

You'll have to use 'uint64_t buffer[eventlength/8]' to  get the
alignment fixed up, but otherwise, this looks good. Although, frankly,
having a malloc'd buffer which gets resized as necessary is far from the
worse thing this code could do, and avoids stack overflow problems if
'eventlength' turns out to be mis-computed.

-- 
-keith

Attachment: signature.asc
Description: PGP signature

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to