From 2a1288ff89322a2f49c79f6d1832c8164c14a05c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 10 Jun 2015 19:10:47 +0200 Subject: util: introduce CMSG_FOREACH() macro and make use of it everywhere It's only marginally shorter then the usual for() loop, but certainly more readable. --- src/shared/macro.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/shared/macro.h') diff --git a/src/shared/macro.h b/src/shared/macro.h index 7ae1ed80b6..cc1c9e73c0 100644 --- a/src/shared/macro.h +++ b/src/shared/macro.h @@ -467,4 +467,7 @@ do { \ } \ struct __useless_struct_to_allow_trailing_semicolon__ +#define CMSG_FOREACH(cmsg, mh) \ + for ((cmsg) = CMSG_FIRSTHDR(mh); (cmsg); (cmsg) = CMSG_NXTHDR((mh), (cmsg))) + #include "log.h" -- cgit v1.2.3-54-g00ecf