diff options
author | Dan Streetman <ddstreet@ieee.org> | 2022-12-06 19:07:34 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2023-01-24 19:33:43 +0100 |
commit | 40c5cc2b214fd47ebfe85786a2a220bd3e9f275a (patch) | |
tree | 07764acbdd87dde4091a4e1abc820c030c159a5b /src/basic/fd-util.h | |
parent | man: clarify that MESSAGE= should not appear more than once in the same journ... (diff) | |
download | systemd-40c5cc2b214fd47ebfe85786a2a220bd3e9f275a.tar.xz systemd-40c5cc2b214fd47ebfe85786a2a220bd3e9f275a.zip |
Consolidate various TAKE_* into TAKE_GENERIC(), add TAKE_STRUCT()
Diffstat (limited to 'src/basic/fd-util.h')
-rw-r--r-- | src/basic/fd-util.h | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h index 97339254ba..952afdd64f 100644 --- a/src/basic/fd-util.h +++ b/src/basic/fd-util.h @@ -90,14 +90,8 @@ static inline int make_null_stdio(void) { return rearrange_stdio(-EBADF, -EBADF, -EBADF); } -/* Like TAKE_PTR() but for file descriptors, resetting them to -1 */ -#define TAKE_FD(fd) \ - ({ \ - int *_fd_ = &(fd); \ - int _ret_ = *_fd_; \ - *_fd_ = -EBADF; \ - _ret_; \ - }) +/* Like TAKE_PTR() but for file descriptors, resetting them to -EBADF */ +#define TAKE_FD(fd) TAKE_GENERIC(fd, int, -EBADF) /* Like free_and_replace(), but for file descriptors */ #define close_and_replace(a, b) \ |