Compute alignment correctly
authorUli Schlachter <psychon@znc.in>
Wed, 24 Aug 2011 10:47:16 +0000 (12:47 +0200)
committerPeter Harris <pharris@opentext.com>
Wed, 24 Aug 2011 14:28:49 +0000 (10:28 -0400)
commitaa02096b8e7f94ad3c998a8d5af54963ee860b13
treeb32be331d88adc6c4ad489941aedf6569baa10de
parent4f25ee16443b29e1a25bd26a724e1e0a577e21ff
Compute alignment correctly

The code previously assumed that everything has to be aligned to a 4 byte
boundary. This assumption is wrong as e.g. the STR struct from xproto shows.

Instead, each type has to be aligned to its natural alignment. So a char doesn't
need any alignment, a INT16 gets aligned to a 2-byte-boundary and a INT32 gets
the old 4 byte alignment.

I'm not 100% sure that this commit is correct, but some quick tests with awesome
and cairo-xcb went well.

This commit causes lots of dead assignments to xcb_align_to since only the last
field's alignment is actually used, but this simplified this patch a lot.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=34037

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Peter Harris <pharris@opentext.com>
src/c_client.py