]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/network/networkd-nexthop.c
tree-wide: use set_ensure_put()
[thirdparty/systemd.git] / src / network / networkd-nexthop.c
index 45c13ca88f3245e4caeef569c84f9e8ae5ac3515..5d91d791d17f21b4b60cbe48157347499b21c0c1 100644 (file)
@@ -209,11 +209,7 @@ static int nexthop_add_internal(Link *link, Set **nexthops, NextHop *in, NextHop
         nexthop->family = in->family;
         nexthop->gw = in->gw;
 
-        r = set_ensure_allocated(nexthops, &nexthop_hash_ops);
-        if (r < 0)
-                return r;
-
-        r = set_put(*nexthops, nexthop);
+        r = set_ensure_put(nexthops, &nexthop_hash_ops, nexthop);
         if (r < 0)
                 return r;
         if (r == 0)
@@ -245,11 +241,7 @@ int nexthop_add(Link *link, NextHop *in, NextHop **ret) {
                         return r;
         } else if (r == 0) {
                 /* Take over a foreign nexthop */
-                r = set_ensure_allocated(&link->nexthops, &nexthop_hash_ops);
-                if (r < 0)
-                        return r;
-
-                r = set_put(link->nexthops, nexthop);
+                r = set_ensure_put(&link->nexthops, &nexthop_hash_ops, nexthop);
                 if (r < 0)
                         return r;