chiark / gitweb /
resolve: fix compilation on LLVM+clang
authorDavid Herrmann <dh.herrmann@gmail.com>
Fri, 15 Aug 2014 14:58:16 +0000 (16:58 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Fri, 15 Aug 2014 14:59:09 +0000 (16:59 +0200)
LLVM+clang does not allow statement-expressions inside of
type-declarations (file-scope). Use CONST_MAX() to avoid this.

src/resolve/resolved-dns-stream.c
src/resolve/resolved-manager.c

index eb78587ae654a865b393e5d990496a33ee663919..8b3a3ced4b7724341736a8928a70afb2f7910da8 100644 (file)
@@ -64,7 +64,7 @@ static int dns_stream_complete(DnsStream *s, int error) {
 static int dns_stream_identify(DnsStream *s) {
         union {
                 struct cmsghdr header; /* For alignment */
-                uint8_t buffer[CMSG_SPACE(MAX(sizeof(struct in_pktinfo), sizeof(struct in6_pktinfo)))
+                uint8_t buffer[CMSG_SPACE(CONST_MAX(sizeof(struct in_pktinfo), sizeof(struct in6_pktinfo)))
                                + EXTRA_CMSG_SPACE /* kernel appears to require extra space */];
         } control;
         struct msghdr mh = {};
index bfbdc7d55bc43aacd49cf64e4ec5075c9c4e2062..04ee204074107d54dc2e99c6d90acfa0f4b2d866 100644 (file)
@@ -841,7 +841,7 @@ int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret) {
         _cleanup_(dns_packet_unrefp) DnsPacket *p = NULL;
         union {
                 struct cmsghdr header; /* For alignment */
-                uint8_t buffer[CMSG_SPACE(MAX(sizeof(struct in_pktinfo), sizeof(struct in6_pktinfo)))
+                uint8_t buffer[CMSG_SPACE(CONST_MAX(sizeof(struct in_pktinfo), sizeof(struct in6_pktinfo)))
                                + CMSG_SPACE(int) /* ttl/hoplimit */
                                + EXTRA_CMSG_SPACE /* kernel appears to require extra buffer space */];
         } control;