]> git.ipfire.org Git - thirdparty/tor.git/commit
memarea.c: use flexible array member for mem
authorNick Mathewson <nickm@torproject.org>
Tue, 18 Mar 2014 14:02:27 +0000 (10:02 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 18 Mar 2014 14:02:27 +0000 (10:02 -0400)
commit204f7255f4c06fe12d99e785b91ea2fb18047018
treec70d8d99a5ebf689edb78a5ac8e4c094e632c6db
parent98b1aad2018b572e19d2404ea7369afa2d0c4b05
memarea.c: use flexible array member for mem

This make clang's memory sanitizer happier that we aren't reading
off the end of a char[1].  We hadn't replaced the char[1] with a
char[FLEXIBLE_ARRAY_MEMBER] before because we were doing a union
trick to force alignment.  Now we use __attribute__(aligned) where
available, and we do the union trick elsewhere.

Most of this patch is just replacing accesses to (x)->u.mem with
(x)->U_MEM, where U_MEM is defined as "u.mem" or "mem" depending on
our implementation.
src/common/memarea.c