X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Ffdset.h;fp=src%2Fshared%2Ffdset.h;h=1a26005183df59451fa9c11cd0aa1f4030d5e757;hb=51d122af23533b0b8318911c4fc8b128ad8eafb7;hp=a7bd5e2b40a798c9fae698440cdece50409f82e5;hpb=a3e7f417d72ba3251fd6b3a228a2721a4b725a03;p=elogind.git diff --git a/src/shared/fdset.h b/src/shared/fdset.h index a7bd5e2b4..1a2600518 100644 --- a/src/shared/fdset.h +++ b/src/shared/fdset.h @@ -22,6 +22,7 @@ ***/ #include "set.h" +#include "util.h" typedef struct FDSet FDSet; @@ -47,3 +48,9 @@ int fdset_iterate(FDSet *s, Iterator *i); #define FDSET_FOREACH(fd, fds, i) \ for ((i) = ITERATOR_FIRST, (fd) = fdset_iterate((fds), &(i)); (fd) >= 0; (fd) = fdset_iterate((fds), &(i))) + +static inline void fdset_freep(FDSet **fds) { + if (*fds) + fdset_free(*fds); +} +#define _cleanup_fdset_free_ _cleanup_(fdset_freep)