From 742f41adb1b7251fcdf2201632c2a980282cdcc4 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 24 Apr 2015 19:54:29 +0200 Subject: core: minor simplification --- src/core/unit.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/core/unit.c b/src/core/unit.c index 730492e226..496db6c4cd 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -3643,11 +3643,9 @@ int unit_require_mounts_for(Unit *u, const char *path) { if (!x) { char *q; - if (!u->manager->units_requiring_mounts_for) { - u->manager->units_requiring_mounts_for = hashmap_new(&string_hash_ops); - if (!u->manager->units_requiring_mounts_for) - return -ENOMEM; - } + r = hashmap_ensure_allocated(&u->manager->units_requiring_mounts_for, &string_hash_ops); + if (r < 0) + return r; q = strdup(prefix); if (!q) -- cgit v1.2.3-54-g00ecf