chiark / gitweb /
Remove repeated includes
[elogind.git] / src / sysv-generator / sysv-generator.c
index 368d420df3bb450dd59645cb0e6f9a2cfa512231..6e4cdd694e5a877957d8e7bb980e531eea861ab0 100644 (file)
@@ -31,7 +31,6 @@
 #include "path-util.h"
 #include "path-lookup.h"
 #include "log.h"
-#include "strv.h"
 #include "unit.h"
 #include "unit-name.h"
 #include "special.h"
@@ -114,9 +113,9 @@ static int add_symlink(const char *service, const char *where) {
 }
 
 static int generate_unit_file(SysvStub *s) {
-        char *unit;
         char **p;
         _cleanup_fclose_ FILE *f = NULL;
+        _cleanup_free_ char *unit = NULL;
         _cleanup_free_ char *before = NULL;
         _cleanup_free_ char *after = NULL;
         _cleanup_free_ char *wants = NULL;
@@ -810,9 +809,8 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
                                         goto finish;
                                 }
 
-                                if (hashmap_contains(all_services, name))
-                                        service = hashmap_get(all_services, name);
-                                else {
+                                service = hashmap_get(all_services, name);
+                                if (!service){
                                         log_warning("Could not find init script for %s", name);
                                         continue;
                                 }
@@ -824,8 +822,7 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
                                                         MAX(a*10 + b, service->sysv_start_priority);
                                         }
 
-                                        r = set_ensure_allocated(&runlevel_services[i],
-                                                                 trivial_hash_func, trivial_compare_func);
+                                        r = set_ensure_allocated(&runlevel_services[i], NULL);
                                         if (r < 0)
                                                 goto finish;
 
@@ -836,8 +833,7 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
                                 } else if (de->d_name[0] == 'K' &&
                                            (rcnd_table[i].type == RUNLEVEL_DOWN)) {
 
-                                        r = set_ensure_allocated(&shutdown_services,
-                                                                 trivial_hash_func, trivial_compare_func);
+                                        r = set_ensure_allocated(&shutdown_services, NULL);
                                         if (r < 0)
                                                 goto finish;
 
@@ -905,7 +901,7 @@ int main(int argc, char *argv[]) {
                 return EXIT_FAILURE;
         }
 
-        all_services = hashmap_new(string_hash_func, string_compare_func);
+        all_services = hashmap_new(&string_hash_ops);
         if (!all_services) {
                 log_oom();
                 return EXIT_FAILURE;