diff options
author | Andreas Rammhold <andreas@rammhold.de> | 2017-09-29 09:58:22 +0200 |
---|---|---|
committer | Andreas Rammhold <andreas@rammhold.de> | 2017-10-02 13:09:56 +0200 |
commit | ec2ce0c5d7623c83dabf50c98253f5b0c0fb1359 (patch) | |
tree | 2be64c5b07a1c2cde8c2244a78b5e4c5e125e4b9 /src/basic | |
parent | tree-wide: use IN_SET where possible (diff) | |
download | systemd-ec2ce0c5d7623c83dabf50c98253f5b0c0fb1359.tar.xz systemd-ec2ce0c5d7623c83dabf50c98253f5b0c0fb1359.zip |
tree-wide: use `!IN_SET(..)` for `a != b && a != c && …`
The included cocci was used to generate the changes.
Thanks to @flo-wer for pointing this case out.
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/rm-rf.c | 2 | ||||
-rw-r--r-- | src/basic/socket-util.c | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/basic/rm-rf.c b/src/basic/rm-rf.c index 3f80ed263a..77fe88e42c 100644 --- a/src/basic/rm-rf.c +++ b/src/basic/rm-rf.c @@ -202,7 +202,7 @@ int rm_rf(const char *path, RemoveFlags flags) { fd = open(path, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME); if (fd < 0) { - if (errno != ENOTDIR && errno != ELOOP) + if (!IN_SET(errno, ENOTDIR, ELOOP)) return -errno; if (!(flags & REMOVE_PHYSICAL)) { diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c index c2f795b4d8..e8d39674cc 100644 --- a/src/basic/socket-util.c +++ b/src/basic/socket-util.c @@ -268,7 +268,7 @@ int socket_address_verify(const SocketAddress *a) { if (a->sockaddr.in.sin_port == 0) return -EINVAL; - if (a->type != SOCK_STREAM && a->type != SOCK_DGRAM) + if (!IN_SET(a->type, SOCK_STREAM, SOCK_DGRAM)) return -EINVAL; return 0; @@ -280,7 +280,7 @@ int socket_address_verify(const SocketAddress *a) { if (a->sockaddr.in6.sin6_port == 0) return -EINVAL; - if (a->type != SOCK_STREAM && a->type != SOCK_DGRAM) + if (!IN_SET(a->type, SOCK_STREAM, SOCK_DGRAM)) return -EINVAL; return 0; @@ -304,7 +304,7 @@ int socket_address_verify(const SocketAddress *a) { } } - if (a->type != SOCK_STREAM && a->type != SOCK_DGRAM && a->type != SOCK_SEQPACKET) + if (!IN_SET(a->type, SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET)) return -EINVAL; return 0; @@ -314,7 +314,7 @@ int socket_address_verify(const SocketAddress *a) { if (a->size != sizeof(struct sockaddr_nl)) return -EINVAL; - if (a->type != SOCK_RAW && a->type != SOCK_DGRAM) + if (!IN_SET(a->type, SOCK_RAW, SOCK_DGRAM)) return -EINVAL; return 0; @@ -323,7 +323,7 @@ int socket_address_verify(const SocketAddress *a) { if (a->size != sizeof(struct sockaddr_vm)) return -EINVAL; - if (a->type != SOCK_STREAM && a->type != SOCK_DGRAM) + if (!IN_SET(a->type, SOCK_STREAM, SOCK_DGRAM)) return -EINVAL; return 0; |