GVariant: One more FreeBSD fix
authorRyan Lortie <desrt@desrt.ca>
Thu, 27 May 2010 15:32:34 +0000 (11:32 -0400)
committerRyan Lortie <desrt@desrt.ca>
Thu, 27 May 2010 15:32:34 +0000 (11:32 -0400)
commite7927faf1792ad4c3c8a5b599240a7ee94b1a0cc
treee82c0e42654d2eeef3ceb814e766691f57afe19f
parent271997deb56cc17af5fa7b59b3a67f4ee347be6c
GVariant: One more FreeBSD fix

FreeBSD's malloc() sometimes returns unaligned memory if you are
requesting small sizes.  This can get GVariant into trouble.  For
example, consider the type "mmi" containing the value "just nothing".
According to the type signature, the memory containing this should be
aligned to a boundary of 4 since it might contain an int.  The
serialised size of this value is 1 byte, however, and when you ask
FreeBSD to allocate memory of that size, it knows you can't put an int
into it so it doesn't bother aligning it.

This patch modifies the GVariant serialiser to not assert the alignment
constraint in the case that the size of the serialised data is smaller
than its own alignment requirement.
glib/gvariant-serialiser.c