chiark / gitweb /
unit: move UnitDependency to unit-name
[elogind.git] / src / core / manager.c
index 9abdf475cf1ea9404a21a409837680eaee16daf2..e0c1cd187e87db3d5aca127b083bcb8a30cf9475 100644 (file)
@@ -449,27 +449,27 @@ int manager_new(SystemdRunningAs running_as, bool test_run, Manager **_m) {
         if (r < 0)
                 goto fail;
 
-        r = hashmap_ensure_allocated(&m->units, string_hash_func, string_compare_func);
+        r = hashmap_ensure_allocated(&m->units, &string_hash_ops);
         if (r < 0)
                 goto fail;
 
-        r = hashmap_ensure_allocated(&m->jobs, trivial_hash_func, trivial_compare_func);
+        r = hashmap_ensure_allocated(&m->jobs, NULL);
         if (r < 0)
                 goto fail;
 
-        r = hashmap_ensure_allocated(&m->cgroup_unit, string_hash_func, string_compare_func);
+        r = hashmap_ensure_allocated(&m->cgroup_unit, &string_hash_ops);
         if (r < 0)
                 goto fail;
 
-        r = hashmap_ensure_allocated(&m->watch_bus, string_hash_func, string_compare_func);
+        r = hashmap_ensure_allocated(&m->watch_bus, &string_hash_ops);
         if (r < 0)
                 goto fail;
 
-        r = set_ensure_allocated(&m->startup_units, trivial_hash_func, trivial_compare_func);
+        r = set_ensure_allocated(&m->startup_units, NULL);
         if (r < 0)
                 goto fail;
 
-        r = set_ensure_allocated(&m->failed_units, trivial_hash_func, trivial_compare_func);
+        r = set_ensure_allocated(&m->failed_units, NULL);
         if (r < 0)
                 goto fail;
 
@@ -896,14 +896,14 @@ static int manager_coldplug(Manager *m) {
 
 static void manager_build_unit_path_cache(Manager *m) {
         char **i;
-        _cleanup_free_ DIR *d = NULL;
+        _cleanup_closedir_ DIR *d = NULL;
         int r;
 
         assert(m);
 
         set_free_free(m->unit_path_cache);
 
-        m->unit_path_cache = set_new(string_hash_func, string_compare_func);
+        m->unit_path_cache = set_new(&string_hash_ops);
         if (!m->unit_path_cache) {
                 log_error("Failed to allocate unit path cache.");
                 return;
@@ -2751,8 +2751,10 @@ int manager_environment_add(Manager *m, char **minus, char **plus) {
 
         if (!strv_isempty(plus)) {
                 b = strv_env_merge(2, l, plus);
-                if (!b)
+                if (!b) {
+                        strv_free(a);
                         return -ENOMEM;
+                }
 
                 l = b;
         }