From b71a721fbc5bd4e7d45fd39c0af79e985c9c6b22 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 1 Nov 2023 16:48:42 +0100 Subject: parse-util: add parse_tristate() and use it everywhere We parse tristates all the time, let's add an explicit parser for them. --- src/network/networkd-nexthop.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/network/networkd-nexthop.c') 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; } -- cgit v1.2.3