diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-11-01 16:48:42 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-11-01 20:52:16 +0100 |
commit | b71a721fbc5bd4e7d45fd39c0af79e985c9c6b22 (patch) | |
tree | da0712dd9ce4e76457f69525cac84b3f7811fde8 /src/network/networkd-nexthop.c | |
parent | build(deps): bump meson from 1.2.2 to 1.2.3 in /.github/workflows (diff) | |
download | systemd-b71a721fbc5bd4e7d45fd39c0af79e985c9c6b22.tar.xz systemd-b71a721fbc5bd4e7d45fd39c0af79e985c9c6b22.zip |
parse-util: add parse_tristate() and use it everywhere
We parse tristates all the time, let's add an explicit parser for them.
Diffstat (limited to 'src/network/networkd-nexthop.c')
-rw-r--r-- | src/network/networkd-nexthop.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c index 2af65ec260..e2ded28197 100644 --- a/src/network/networkd-nexthop.c +++ b/src/network/networkd-nexthop.c @@ -1229,21 +1229,13 @@ int config_parse_nexthop_onlink( if (r < 0) return log_oom(); - if (isempty(rvalue)) { - n->onlink = -1; - TAKE_PTR(n); - return 0; - } - - r = parse_boolean(rvalue); + r = parse_tristate(rvalue, &n->onlink); if (r < 0) { log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue); return 0; } - n->onlink = r; - TAKE_PTR(n); return 0; } |