]> git.ipfire.org Git - thirdparty/systemd.git/commit
shared: add MAXSIZE() and use it in resolved
authorDavid Herrmann <dh.herrmann@gmail.com>
Fri, 22 Aug 2014 11:55:57 +0000 (13:55 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Fri, 22 Aug 2014 12:01:05 +0000 (14:01 +0200)
commit40a1eebde6be7ac3f1885147fc24e06ad1da260c
treea03d9895d6577fe38480633774050f41ae5ba079
parent0975b63fb31263e535a2d26ed41e66e23f468bc5
shared: add MAXSIZE() and use it in resolved

The MAXSIZE() macro takes two types and returns the size of the larger
one. It is much simpler to use than MAX(sizeof(A), sizeof(B)) and also
avoids any compiler-extensions, unlike CONST_MAX() and MAX() (which are
needed to avoid evaluating arguments more than once). This was suggested
by Daniele Nicolodi <daniele@grinta.net>.

Also make resolved use this macro instead of CONST_MAX(). This enhances
readability quite a bit.
src/resolve/resolved-dns-stream.c
src/resolve/resolved-manager.c
src/shared/macro.h
src/test/test-util.c