diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/bus-util.c | 8 | ||||
-rw-r--r-- | src/shared/bus-wait-for-jobs.c | 10 | ||||
-rw-r--r-- | src/shared/logs-show.c | 23 | ||||
-rw-r--r-- | src/shared/mount-util.c | 4 | ||||
-rw-r--r-- | src/shared/unit-file.c | 4 |
5 files changed, 17 insertions, 32 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index df701a3bfe..c7611a6e85 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -1695,14 +1695,10 @@ int bus_introspect_implementations( if (impl != main_impl) bus_introspect_implementation(&intro, impl); - _cleanup_set_free_free_ Set *nodes = NULL; + _cleanup_set_free_ Set *nodes = NULL; for (size_t i = 0; impl->children && impl->children[i]; i++) { - r = set_ensure_allocated(&nodes, &string_hash_ops); - if (r < 0) - return log_oom(); - - r = set_put_strdup(nodes, impl->children[i]->path); + r = set_put_strdup(&nodes, impl->children[i]->path); if (r < 0) return log_oom(); } diff --git a/src/shared/bus-wait-for-jobs.c b/src/shared/bus-wait-for-jobs.c index 4e6b862d5e..eb33ba2340 100644 --- a/src/shared/bus-wait-for-jobs.c +++ b/src/shared/bus-wait-for-jobs.c @@ -65,7 +65,7 @@ void bus_wait_for_jobs_free(BusWaitForJobs *d) { if (!d) return; - set_free_free(d->jobs); + set_free(d->jobs); sd_bus_slot_unref(d->slot_disconnected); sd_bus_slot_unref(d->slot_job_removed); @@ -315,15 +315,9 @@ int bus_wait_for_jobs(BusWaitForJobs *d, bool quiet, const char* const* extra_ar } int bus_wait_for_jobs_add(BusWaitForJobs *d, const char *path) { - int r; - assert(d); - r = set_ensure_allocated(&d->jobs, &string_hash_ops); - if (r < 0) - return r; - - return set_put_strdup(d->jobs, path); + return set_put_strdup(&d->jobs, path); } int bus_wait_for_jobs_one(BusWaitForJobs *d, const char *path, bool quiet) { diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 6737cda1d2..eade4dfbfd 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -1133,30 +1133,25 @@ int show_journal_entry( const size_t highlight[2], bool *ellipsized) { - int ret; - _cleanup_set_free_free_ Set *fields = NULL; + _cleanup_set_free_ Set *fields = NULL; + int r; + assert(mode >= 0); assert(mode < _OUTPUT_MODE_MAX); if (n_columns <= 0) n_columns = columns(); - if (output_fields) { - fields = set_new(&string_hash_ops); - if (!fields) - return log_oom(); - - ret = set_put_strdupv(fields, output_fields); - if (ret < 0) - return ret; - } + r = set_put_strdupv(&fields, output_fields); + if (r < 0) + return r; - ret = output_funcs[mode](f, j, mode, n_columns, flags, fields, highlight); + r = output_funcs[mode](f, j, mode, n_columns, flags, fields, highlight); - if (ellipsized && ret > 0) + if (ellipsized && r > 0) *ellipsized = true; - return ret; + return r; } static int maybe_print_begin_newline(FILE *f, OutputFlags *flags) { diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index ae6ff9108a..f3ee656c0f 100644 --- a/src/shared/mount-util.c +++ b/src/shared/mount-util.c @@ -239,7 +239,7 @@ int bind_remount_recursive_with_mountinfo( } if (!set_contains(done, path)) { - r = set_put_strdup(todo, path); + r = set_put_strdup(&todo, path); if (r < 0) return r; } @@ -266,7 +266,7 @@ int bind_remount_recursive_with_mountinfo( log_debug("Made top-level directory %s a mount point.", prefix); - r = set_put_strdup(done, simplified); + r = set_put_strdup(&done, simplified); if (r < 0) return r; } diff --git a/src/shared/unit-file.c b/src/shared/unit-file.c index 7b64bbf7f1..4fe2489c55 100644 --- a/src/shared/unit-file.c +++ b/src/shared/unit-file.c @@ -463,7 +463,7 @@ int unit_file_find_fragment( /* The unit always has its own name if it's not a template. */ if (IN_SET(name_type, UNIT_NAME_PLAIN, UNIT_NAME_INSTANCE)) { - r = set_put_strdup(names, unit_name); + r = set_put_strdup(&names, unit_name); if (r < 0) return r; } @@ -493,7 +493,7 @@ int unit_file_find_fragment( if (!streq(unit_name, *t)) log_debug("%s: %s has alias %s", __func__, unit_name, *t); - r = set_put_strdup(names, *t); + r = set_put_strdup(&names, *t); } if (r < 0) return r; |