diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2024-03-19 21:08:52 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2024-03-20 15:18:21 +0100 |
commit | 6a705f1234919c255cc230403ad6749edabf83be (patch) | |
tree | 325220dfa5cf279a7ce9af3babf04631d90fc2d2 /src/network | |
parent | basic/string-util: use strdup_to() in string_extract_line() (diff) | |
download | systemd-6a705f1234919c255cc230403ad6749edabf83be.tar.xz systemd-6a705f1234919c255cc230403ad6749edabf83be.zip |
Replace strdup_or_null() by strdup_to()
I didn't know that this helper existed… It is very similar to strdup_to_full(),
but all callers can actually be replaced by strdup_to(), which has more fitting
semantics.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-address.c | 4 | ||||
-rw-r--r-- | src/network/networkd-route-metric.c | 2 | ||||
-rw-r--r-- | src/network/networkd-route-nexthop.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index d9c3dae85c..38cdadcf61 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -613,12 +613,12 @@ int address_dup(const Address *src, Address **ret) { dest->nft_set_context.n_sets = 0; if (src->family == AF_INET) { - r = strdup_or_null(src->label, &dest->label); + r = strdup_to(&dest->label, src->label); if (r < 0) return r; } - r = strdup_or_null(src->netlabel, &dest->netlabel); + r = strdup_to(&dest->netlabel, src->netlabel); if (r < 0) return r; diff --git a/src/network/networkd-route-metric.c b/src/network/networkd-route-metric.c index 1bae893934..31a2bdea24 100644 --- a/src/network/networkd-route-metric.c +++ b/src/network/networkd-route-metric.c @@ -39,7 +39,7 @@ int route_metric_copy(const RouteMetric *src, RouteMetric *dest) { } else dest->metrics_set = NULL; - return strdup_or_null(src->tcp_congestion_control_algo, &dest->tcp_congestion_control_algo); + return strdup_to(&dest->tcp_congestion_control_algo, src->tcp_congestion_control_algo); } void route_metric_hash_func(const RouteMetric *metric, struct siphash *state) { diff --git a/src/network/networkd-route-nexthop.c b/src/network/networkd-route-nexthop.c index 8ba7505987..11215c36c7 100644 --- a/src/network/networkd-route-nexthop.c +++ b/src/network/networkd-route-nexthop.c @@ -218,7 +218,7 @@ static int route_nexthop_copy(const RouteNextHop *src, RouteNextHop *dest) { /* unset pointer copied in the above. */ dest->ifname = NULL; - return strdup_or_null(src->ifindex > 0 ? NULL : src->ifname, &dest->ifname); + return strdup_to(&dest->ifname, src->ifindex > 0 ? NULL : src->ifname); } static int route_nexthop_dup(const RouteNextHop *src, RouteNextHop **ret) { |