summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-09 23:12:07 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-09 23:12:07 +0200
commit525d3cc746a037e8cc6b2e0ebaaf76a51856fa6b (patch)
treec96ffcfb5a7bf46fdbbd4ea6bf801bc3b3cf7acd /src
parent6796073e330f49923c5134652ee085e29fc88002 (diff)
tree-wide: take benefit of the fact that hashmap_free() returns NULL
And set_free() too. Another Coccinelle patch.
Diffstat (limited to 'src')
-rw-r--r--src/core/automount.c6
-rw-r--r--src/core/dbus.c3
-rw-r--r--src/core/device.c3
-rw-r--r--src/core/execute.c11
-rw-r--r--src/core/load-fragment.c9
-rw-r--r--src/core/main.c3
-rw-r--r--src/core/swap.c3
-rw-r--r--src/core/unit.c3
-rw-r--r--src/resolve/resolved-dns-zone.c7
9 files changed, 15 insertions, 33 deletions
diff --git a/src/core/automount.c b/src/core/automount.c
index 5bb61b95d3..c88e3311bc 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -129,10 +129,8 @@ static void automount_done(Unit *u) {
a->where = mfree(a->where);
- set_free(a->tokens);
- a->tokens = NULL;
- set_free(a->expire_tokens);
- a->expire_tokens = NULL;
+ a->tokens = set_free(a->tokens);
+ a->expire_tokens = set_free(a->expire_tokens);
a->expire_event_source = sd_event_source_unref(a->expire_event_source);
}
diff --git a/src/core/dbus.c b/src/core/dbus.c
index dcaf7cc835..2d6a1ff836 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -1055,8 +1055,7 @@ void bus_done(Manager *m) {
while ((b = set_steal_first(m->private_buses)))
destroy_bus(m, &b);
- set_free(m->private_buses);
- m->private_buses = NULL;
+ m->private_buses = set_free(m->private_buses);
m->subscribed = sd_bus_track_unref(m->subscribed);
m->deserialized_subscribed = strv_free(m->deserialized_subscribed);
diff --git a/src/core/device.c b/src/core/device.c
index 7fdfacfddf..0b54518691 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -594,8 +594,7 @@ static void device_shutdown(Manager *m) {
m->udev_monitor = NULL;
}
- hashmap_free(m->devices_by_sysfs);
- m->devices_by_sysfs = NULL;
+ m->devices_by_sysfs = hashmap_free(m->devices_by_sysfs);
}
static int device_enumerate(Manager *m) {
diff --git a/src/core/execute.c b/src/core/execute.c
index 86c2a80673..d1acda6682 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -2025,14 +2025,9 @@ void exec_context_done(ExecContext *c) {
c->selinux_context = mfree(c->selinux_context);
c->apparmor_profile = mfree(c->apparmor_profile);
- set_free(c->syscall_filter);
- c->syscall_filter = NULL;
-
- set_free(c->syscall_archs);
- c->syscall_archs = NULL;
-
- set_free(c->address_families);
- c->address_families = NULL;
+ c->syscall_filter = set_free(c->syscall_filter);
+ c->syscall_archs = set_free(c->syscall_archs);
+ c->address_families = set_free(c->address_families);
c->runtime_directory = strv_free(c->runtime_directory);
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 79dd3075c9..3b02cd8085 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2302,8 +2302,7 @@ int config_parse_syscall_filter(
if (isempty(rvalue)) {
/* Empty assignment resets the list */
- set_free(c->syscall_filter);
- c->syscall_filter = NULL;
+ c->syscall_filter = set_free(c->syscall_filter);
c->syscall_whitelist = false;
return 0;
}
@@ -2401,8 +2400,7 @@ int config_parse_syscall_archs(
int r;
if (isempty(rvalue)) {
- set_free(*archs);
- *archs = NULL;
+ *archs = set_free(*archs);
return 0;
}
@@ -2498,8 +2496,7 @@ int config_parse_address_families(
if (isempty(rvalue)) {
/* Empty assignment resets the list */
- set_free(c->address_families);
- c->address_families = NULL;
+ c->address_families = set_free(c->address_families);
c->address_families_whitelist = false;
return 0;
}
diff --git a/src/core/main.c b/src/core/main.c
index be95dc68b2..c9657505c3 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1846,8 +1846,7 @@ finish:
arg_default_environment = strv_free(arg_default_environment);
- set_free(arg_syscall_archs);
- arg_syscall_archs = NULL;
+ arg_syscall_archs = set_free(arg_syscall_archs);
mac_selinux_finish();
diff --git a/src/core/swap.c b/src/core/swap.c
index 311ce7ee04..bef457069f 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -1254,8 +1254,7 @@ static void swap_shutdown(Manager *m) {
m->proc_swaps = safe_fclose(m->proc_swaps);
- hashmap_free(m->swaps_by_devnode);
- m->swaps_by_devnode = NULL;
+ m->swaps_by_devnode = hashmap_free(m->swaps_by_devnode);
}
static int swap_enumerate(Manager *m) {
diff --git a/src/core/unit.c b/src/core/unit.c
index 563d7bf254..e40ea24be8 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -673,8 +673,7 @@ static void merge_dependencies(Unit *u, Unit *other, const char *other_id, UnitD
/* The move cannot fail. The caller must have performed a reservation. */
assert_se(complete_move(&u->dependencies[d], &other->dependencies[d]) == 0);
- set_free(other->dependencies[d]);
- other->dependencies[d] = NULL;
+ other->dependencies[d] = set_free(other->dependencies[d]);
}
int unit_merge(Unit *u, Unit *other) {
diff --git a/src/resolve/resolved-dns-zone.c b/src/resolve/resolved-dns-zone.c
index 674bb6af28..8a59bd1c3c 100644
--- a/src/resolve/resolved-dns-zone.c
+++ b/src/resolve/resolved-dns-zone.c
@@ -90,11 +90,8 @@ void dns_zone_flush(DnsZone *z) {
assert(hashmap_size(z->by_key) == 0);
assert(hashmap_size(z->by_name) == 0);
- hashmap_free(z->by_key);
- z->by_key = NULL;
-
- hashmap_free(z->by_name);
- z->by_name = NULL;
+ z->by_key = hashmap_free(z->by_key);
+ z->by_name = hashmap_free(z->by_name);
}
static DnsZoneItem* dns_zone_get(DnsZone *z, DnsResourceRecord *rr) {