summaryrefslogtreecommitdiff
path: root/src/shared/macro.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-06-10 19:10:47 +0200
committerLennart Poettering <lennart@poettering.net>2015-06-10 19:29:47 +0200
commit2a1288ff89322a2f49c79f6d1832c8164c14a05c (patch)
tree02cc41ade7b814d258b183c0ac88670163194913 /src/shared/macro.h
parent5410b2ed62289d8ab6575e64951ac7b6bda51d40 (diff)
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.
Diffstat (limited to 'src/shared/macro.h')
-rw-r--r--src/shared/macro.h3
1 files changed, 3 insertions, 0 deletions
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"