]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/set.c
tree-wide: use TAKE_PTR() and TAKE_FD() macros
[thirdparty/systemd.git] / src / basic / set.c
index fd398b82125115121f573e62bf7bc458ead88b88..da2cc0fb4a827f1d8a257f0bfc4d3c3490b75287 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd.
 
@@ -17,6 +18,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#include "alloc-util.h"
 #include "set.h"
 
 int set_make(Set **ret, const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS, void *add, ...) {
@@ -38,7 +40,7 @@ int set_make(Set **ret, const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS, vo
 
                 va_start(ap, add);
 
-                for(;;) {
+                for (;;) {
                         void *arg = va_arg(ap, void*);
 
                         if (!arg)
@@ -54,8 +56,7 @@ int set_make(Set **ret, const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS, vo
                 va_end(ap);
         }
 
-        *ret = s;
-        s = NULL;
+        *ret = TAKE_PTR(s);
 
         return 0;
 }