bool loaded;
} SysvStub;
-static SysvStub* free_sysvstub(SysvStub *s) {
+static SysvStub* sysvstub_free(SysvStub *s) {
if (!s)
return NULL;
strv_free(s->wanted_by);
return mfree(s);
}
-DEFINE_TRIVIAL_CLEANUP_FUNC(SysvStub*, free_sysvstub);
+DEFINE_TRIVIAL_CLEANUP_FUNC(SysvStub*, sysvstub_free);
-static void free_sysvstub_hashmapp(Hashmap **h) {
- hashmap_free_with_destructor(*h, free_sysvstub);
-}
+DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
+ sysvstub_hash_ops,
+ char, string_hash_func, string_compare_func,
+ SysvStub, sysvstub_free);
static int add_alias(const char *service, const char *alias) {
_cleanup_free_ char *link = NULL;
FOREACH_DIRENT(de, d, log_error_errno(errno, "Failed to enumerate directory %s, ignoring: %m", *path)) {
_cleanup_free_ char *fpath = NULL, *name = NULL;
- _cleanup_(free_sysvstubp) SysvStub *service = NULL;
+ _cleanup_(sysvstub_freep) SysvStub *service = NULL;
struct stat st;
if (fstatat(dirfd(d), de->d_name, &st, 0) < 0) {
}
static int run(const char *dest, const char *dest_early, const char *dest_late) {
- _cleanup_(free_sysvstub_hashmapp) Hashmap *all_services = NULL;
+ _cleanup_hashmap_free_ Hashmap *all_services = NULL;
_cleanup_(lookup_paths_done) LookupPaths lp = {};
SysvStub *service;
int r;
if (r < 0)
return r;
- all_services = hashmap_new(&string_hash_ops);
+ all_services = hashmap_new(&sysvstub_hash_ops);
if (!all_services)
return log_oom();