diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2017-10-04 23:01:32 +0900 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-12-08 07:27:34 +0100 |
commit | 5b65a773c10cdab7e9f36312dd4f7cabea3d9bf5 (patch) | |
tree | b3af58441e6566e5629b721c07f7606b14d79e54 /src/basic/hostname-util.c | |
parent | 76937fb46f5e25e982ea90243b625cf91a869964 (diff) |
tree-wide: use IN_SET macro (#6977)
Diffstat (limited to 'src/basic/hostname-util.c')
-rw-r--r-- | src/basic/hostname-util.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c index 1add67de9..5297b659d 100644 --- a/src/basic/hostname-util.c +++ b/src/basic/hostname-util.c @@ -98,9 +98,7 @@ static bool hostname_valid_char(char c) { (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || - c == '-' || - c == '_' || - c == '.'; + IN_SET(c, '-', '_', '.'); } /** @@ -246,7 +244,7 @@ int read_hostname_config(const char *path, char **hostname) { /* may have comments, ignore them */ FOREACH_LINE(l, f, return -errno) { truncate_nl(l); - if (l[0] != '\0' && l[0] != '#') { + if (!IN_SET(l[0], '\0', '#')) { /* found line with value */ name = hostname_cleanup(l); name = strdup(name); |