chiark / gitweb /
util: introduce CMSG_FOREACH() macro and make use of it everywhere
[elogind.git] / src / shared / macro.h
index 7ae1ed80b6d0d9658672e3bc58d0f6084ad1d7f7..cc1c9e73c08bddcbe39ebee5ac221a14b6d547f1 100644 (file)
@@ -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"