]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/unit.c
basic/set: let set_put_strdup() create the set with string hash ops
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 29 Apr 2020 06:47:51 +0000 (08:47 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 6 May 2020 14:54:06 +0000 (16:54 +0200)
commitbe32732168e07b7d52ec77fa67cf93a80a9a8293
tree0feb0a006050702078fd41b5fea2eee9c4d00b08
parent0894f08bf14b09ef0436ed11268d43dbcdd88ee7
basic/set: let set_put_strdup() create the set with string hash ops

If we're using a set with _put_strdup(), most of the time we want to use
string hash ops on the set, and free the strings when done. This defines
the appropriate a new string_hash_ops_free structure to automatically free
the keys when removing the set, and makes set_put_strdup() and set_put_strdupv()
instantiate the set with those hash ops.

hashmap_put_strdup() was already doing something similar.

(It is OK to instantiate the set earlier, possibly with a different hash ops
structure. set_put_strdup() will then use the existing set. It is also OK
to call set_free_free() instead of set_free() on a set with
string_hash_ops_free, the effect is the same, we're just overriding the
override of the cleanup function.)

No functional change intended.
25 files changed:
src/analyze/analyze-security.c
src/analyze/analyze.c
src/basic/conf-files.c
src/basic/hash-funcs.c
src/basic/hash-funcs.h
src/basic/hashmap.c
src/basic/set.h
src/busctl/busctl.c
src/core/mount.c
src/core/unit.c
src/libsystemd/sd-device/device-enumerator.c
src/libsystemd/sd-device/sd-device.c
src/login/logind-acl.c
src/network/networkd-link-bus.c
src/nspawn/nspawn-cgroup.c
src/portable/portable.c
src/resolve/resolved-dns-trust-anchor.c
src/resolve/resolved-link-bus.c
src/resolve/resolved-link.c
src/shared/bus-util.c
src/shared/bus-wait-for-jobs.c
src/shared/logs-show.c
src/shared/mount-util.c
src/shared/unit-file.c
src/udev/udevadm-trigger.c