From 7fcedbcdd66196b3e02f028bb20809bf0167e985 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 10 Sep 2026 15:09:42 +0200 Subject: [PATCH] analyze: comment bare literal arguments docs/CODING_STYLE.md asks for a /* name= */ comment whenever NULL or another value meaning "unset" is passed to a function. Add it wherever a bare NULL, 0, false or true is passed for a parameter with a telling name. Mechanical, generated by tools/check-argument-comments.py --fix. --- src/analyze/analyze-blame.c | 8 ++++---- src/analyze/analyze-calendar.c | 6 +++--- src/analyze/analyze-capability.c | 2 +- src/analyze/analyze-chid.c | 6 +++--- src/analyze/analyze-critical-chain.c | 6 +++--- src/analyze/analyze-dlopen-metadata.c | 4 ++-- src/analyze/analyze-dot.c | 4 ++-- src/analyze/analyze-dump.c | 12 ++++++------ src/analyze/analyze-exit-status.c | 2 +- src/analyze/analyze-fdstore.c | 4 ++-- src/analyze/analyze-inspect-elf.c | 2 +- src/analyze/analyze-log-control.c | 2 +- src/analyze/analyze-malloc.c | 4 ++-- src/analyze/analyze-nvpcrs.c | 4 ++-- src/analyze/analyze-pcrs.c | 4 ++-- src/analyze/analyze-plot.c | 8 ++++---- src/analyze/analyze-security.c | 12 ++++++------ src/analyze/analyze-service-watchdogs.c | 2 +- src/analyze/analyze-time-data.c | 6 +++--- src/analyze/analyze-time.c | 2 +- src/analyze/analyze-timespan.c | 6 +++--- src/analyze/analyze-timestamp.c | 6 +++--- src/analyze/analyze-unit-files.c | 4 ++-- src/analyze/analyze-unit-paths.c | 2 +- src/analyze/analyze-verify-util.c | 4 ++-- src/analyze/analyze-verify.c | 2 +- src/analyze/analyze.c | 6 +++--- src/analyze/test-verify.c | 14 +++++++------- 28 files changed, 72 insertions(+), 72 deletions(-) diff --git a/src/analyze/analyze-blame.c b/src/analyze/analyze-blame.c index d400380ade9..ae5e0c65e74 100644 --- a/src/analyze/analyze-blame.c +++ b/src/analyze/analyze-blame.c @@ -16,7 +16,7 @@ int verb_blame(int argc, char *argv[], uintptr_t _data, void *userdata) { TableCell *cell; int n, r; - r = acquire_bus(&bus, NULL); + r = acquire_bus(&bus, /* use_full_bus= */ NULL); if (r < 0) return bus_log_connect_error(r, arg_transport, arg_runtime_scope); @@ -28,19 +28,19 @@ int verb_blame(int argc, char *argv[], uintptr_t _data, void *userdata) { if (!table) return log_oom(); - assert_se(cell = table_get_cell(table, 0, 0)); + assert_se(cell = table_get_cell(table, /* row= */ 0, /* column= */ 0)); (void) table_set_ellipsize_percent(table, cell, 100); (void) table_set_align_percent(table, cell, 100); - assert_se(cell = table_get_cell(table, 0, 1)); + assert_se(cell = table_get_cell(table, /* row= */ 0, 1)); (void) table_set_ellipsize_percent(table, cell, 100); r = table_set_sort(table, (size_t) 0); if (r < 0) return table_log_sort_error(r); - r = table_set_reverse(table, 0, true); + r = table_set_reverse(table, /* column= */ 0, true); if (r < 0) return table_log_sort_error(r); diff --git a/src/analyze/analyze-calendar.c b/src/analyze/analyze-calendar.c index f6d434de36f..0e771955683 100644 --- a/src/analyze/analyze-calendar.c +++ b/src/analyze/analyze-calendar.c @@ -34,10 +34,10 @@ static int test_calendar_one(usec_t n, const char *p) { if (!table) return log_oom(); - assert_se(cell = table_get_cell(table, 0, 0)); + assert_se(cell = table_get_cell(table, /* row= */ 0, /* column= */ 0)); (void) table_set_ellipsize_percent(table, cell, 100); - assert_se(cell = table_get_cell(table, 0, 1)); + assert_se(cell = table_get_cell(table, /* row= */ 0, 1)); (void) table_set_ellipsize_percent(table, cell, 100); if (!streq(t, p)) { @@ -87,7 +87,7 @@ static int test_calendar_one(usec_t n, const char *p) { else k = 0; - r = table_add_cell_stringf_full(table, NULL, TABLE_FIELD, "Iteration #%u", i+1); + r = table_add_cell_stringf_full(table, /* ret_cell= */ NULL, TABLE_FIELD, "Iteration #%u", i+1); if (r < 0) return table_log_add_error(r); diff --git a/src/analyze/analyze-capability.c b/src/analyze/analyze-capability.c index 3ddbdb4cc14..d8d1918d39f 100644 --- a/src/analyze/analyze-capability.c +++ b/src/analyze/analyze-capability.c @@ -28,7 +28,7 @@ int verb_capabilities(int argc, char *argv[], uintptr_t _data, void *userdata) { if (!table) return log_oom(); - (void) table_set_align_percent(table, table_get_cell(table, 0, 1), 100); + (void) table_set_align_percent(table, table_get_cell(table, /* row= */ 0, 1), 100); /* Determine the maximum of the last cap known by the kernel and by us */ last_cap = MAX((unsigned) CAP_LAST_CAP, cap_last_cap()); diff --git a/src/analyze/analyze-chid.c b/src/analyze/analyze-chid.c index 896c6e54b36..caf01c76f04 100644 --- a/src/analyze/analyze-chid.c +++ b/src/analyze/analyze-chid.c @@ -297,7 +297,7 @@ static int edid_search(char16_t **ret_panel) { if (r < 0) return log_error_errno(r, "Failed to allow uninitialized device enumerator: %m"); - r = sd_device_enumerator_add_match_subsystem(e, "drm", true); + r = sd_device_enumerator_add_match_subsystem(e, "drm", /* match= */ true); if (r < 0) return log_error_errno(r, "Failed to add drm match subsystem to device enumerator: %m"); @@ -350,8 +350,8 @@ int verb_chid(int argc, char *argv[], uintptr_t _data, void *userdata) { if (!table) return log_oom(); - (void) table_set_align_percent(table, table_get_cell(table, 0, 0), 100); - (void) table_set_align_percent(table, table_get_cell(table, 0, 1), 50); + (void) table_set_align_percent(table, table_get_cell(table, /* row= */ 0, /* column= */ 0), 100); + (void) table_set_align_percent(table, table_get_cell(table, /* row= */ 0, 1), 50); _cleanup_(smbios_fields_free) char16_t* smbios_fields[_CHID_SMBIOS_FIELDS_MAX] = {}; r = smbios_fields_acquire(smbios_fields); diff --git a/src/analyze/analyze-critical-chain.c b/src/analyze/analyze-critical-chain.c index e4f7d52cbb5..ccd1fb04758 100644 --- a/src/analyze/analyze-critical-chain.c +++ b/src/analyze/analyze-critical-chain.c @@ -140,7 +140,7 @@ static int list_dependencies_one(sd_bus *bus, const char *name, unsigned level, if (strv_contains(*units, *c)) { r = list_dependencies_print("...", level + 1, (branches << 1) | (to_print ? 1 : 0), - true, NULL, boot); + /* last= */ true, /* times= */ NULL, boot); if (r < 0) return r; continue; @@ -206,7 +206,7 @@ static int list_dependencies(sd_bus *bus, const char *name) { printf("%s\n", id); } - return list_dependencies_one(bus, name, 0, &units, 0); + return list_dependencies_one(bus, name, /* level= */ 0, &units, /* branches= */ 0); } int verb_critical_chain(int argc, char *argv[], uintptr_t _data, void *userdata) { @@ -214,7 +214,7 @@ int verb_critical_chain(int argc, char *argv[], uintptr_t _data, void *userdata) _cleanup_(unit_times_free_arrayp) UnitTimes *times = NULL; int n, r; - r = acquire_bus(&bus, NULL); + r = acquire_bus(&bus, /* use_full_bus= */ NULL); if (r < 0) return bus_log_connect_error(r, arg_transport, arg_runtime_scope); diff --git a/src/analyze/analyze-dlopen-metadata.c b/src/analyze/analyze-dlopen-metadata.c index 76c161105f3..5ebe6c36f20 100644 --- a/src/analyze/analyze-dlopen-metadata.c +++ b/src/analyze/analyze-dlopen-metadata.c @@ -28,7 +28,7 @@ int verb_dlopen_metadata(int argc, char *argv[], uintptr_t _data, void *userdata arg_root, /* fork_disable_dump= */ false, /* ret= */ NULL, - NULL, + /* ret_package_metadata= */ NULL, &dlopen_metadata); if (r < 0) return log_error_errno(r, "Parsing \"%s\" as ELF object failed: %m", abspath); @@ -37,7 +37,7 @@ int verb_dlopen_metadata(int argc, char *argv[], uintptr_t _data, void *userdata return log_error_errno(SYNTHETIC_ERRNO(ENODATA), "%s does not contain any .note.dlopen sections", argv[1]); if (sd_json_format_enabled(arg_json_format_flags)) - return sd_json_variant_dump(dlopen_metadata, arg_json_format_flags, stdout, NULL); + return sd_json_variant_dump(dlopen_metadata, arg_json_format_flags, stdout, /* prefix= */ NULL); _cleanup_(table_unrefp) Table *t = NULL; t = table_new("feature", "description", "soname", "priority"); diff --git a/src/analyze/analyze-dot.c b/src/analyze/analyze-dot.c index 6f1044aa603..72d955b4e70 100644 --- a/src/analyze/analyze-dot.c +++ b/src/analyze/analyze-dot.c @@ -156,7 +156,7 @@ int verb_dot(int argc, char *argv[], uintptr_t _data, void *userdata) { UnitInfo u; int r; - r = acquire_bus(&bus, NULL); + r = acquire_bus(&bus, /* use_full_bus= */ NULL); if (r < 0) return bus_log_connect_error(r, arg_transport, arg_runtime_scope); @@ -172,7 +172,7 @@ int verb_dot(int argc, char *argv[], uintptr_t _data, void *userdata) { if (r < 0) return r; - r = bus_call_method(bus, bus_systemd_mgr, "ListUnits", &error, &reply, NULL); + r = bus_call_method(bus, bus_systemd_mgr, "ListUnits", &error, &reply, /* types= */ NULL); if (r < 0) return log_error_errno(r, "Failed to list units: %s", bus_error_message(&error, r)); diff --git a/src/analyze/analyze-dump.c b/src/analyze/analyze-dump.c index 25925e4b5b2..fdee086aa3f 100644 --- a/src/analyze/analyze-dump.c +++ b/src/analyze/analyze-dump.c @@ -20,7 +20,7 @@ static int dump_string(sd_bus *bus) { assert(bus); - r = bus_call_method(bus, bus_systemd_mgr, "Dump", &error, &reply, NULL); + r = bus_call_method(bus, bus_systemd_mgr, "Dump", &error, &reply, /* types= */ NULL); if (r < 0) return log_error_errno(r, "Failed to call Dump: %s", bus_error_message(&error, r)); @@ -32,7 +32,7 @@ static int dump_fd(sd_bus *bus) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; int r; - r = bus_call_method(bus, bus_systemd_mgr, "DumpByFileDescriptor", &error, &reply, NULL); + r = bus_call_method(bus, bus_systemd_mgr, "DumpByFileDescriptor", &error, &reply, /* types= */ NULL); if (IN_SET(r, -EACCES, -EBADR)) /* Fall back to non-fd method. We need to do this even if the bus supports sending * fds to cater to very old managers which didn't have the fd-based method. */ @@ -60,7 +60,7 @@ static int dump_patterns_string(sd_bus *bus, char **patterns) { if (r < 0) return bus_log_create_error(r); - r = sd_bus_call(bus, m, 0, &error, &reply); + r = sd_bus_call(bus, m, /* usec= */ 0, &error, &reply); if (r < 0) return log_error_errno(r, "Failed to call DumpUnitsMatchingPatterns: %s", bus_error_message(&error, r)); @@ -84,7 +84,7 @@ static int dump_patterns_fd(sd_bus *bus, char **patterns) { if (r < 0) return bus_log_create_error(r); - r = sd_bus_call(bus, m, 0, &error, &reply); + r = sd_bus_call(bus, m, /* usec= */ 0, &error, &reply); if (r < 0) return log_error_errno(r, "Failed to call DumpUnitsMatchingPatternsByFileDescriptor: %s", bus_error_message(&error, r)); @@ -101,7 +101,7 @@ static int mangle_patterns(char **args, char ***ret) { STRV_FOREACH(arg, args) { char *t; - r = unit_name_mangle_with_suffix(*arg, NULL, UNIT_NAME_MANGLE_GLOB, ".service", &t); + r = unit_name_mangle_with_suffix(*arg, /* operation= */ NULL, UNIT_NAME_MANGLE_GLOB, ".service", &t); if (r < 0) return log_error_errno(r, "Failed to mangle name '%s': %m", *arg); @@ -119,7 +119,7 @@ int verb_dump(int argc, char *argv[], uintptr_t _data, void *userdata) { _cleanup_strv_free_ char **patterns = NULL; int r; - r = acquire_bus(&bus, NULL); + r = acquire_bus(&bus, /* use_full_bus= */ NULL); if (r < 0) return bus_log_connect_error(r, arg_transport, arg_runtime_scope); diff --git a/src/analyze/analyze-exit-status.c b/src/analyze/analyze-exit-status.c index b291ff0ab7c..9461ecd89e3 100644 --- a/src/analyze/analyze-exit-status.c +++ b/src/analyze/analyze-exit-status.c @@ -15,7 +15,7 @@ int verb_exit_status(int argc, char *argv[], uintptr_t _data, void *userdata) { if (!table) return log_oom(); - r = table_set_align_percent(table, table_get_cell(table, 0, 1), 100); + r = table_set_align_percent(table, table_get_cell(table, /* row= */ 0, 1), 100); if (r < 0) return log_error_errno(r, "Failed to right-align status: %m"); diff --git a/src/analyze/analyze-fdstore.c b/src/analyze/analyze-fdstore.c index f9721119f2e..d69a7143dea 100644 --- a/src/analyze/analyze-fdstore.c +++ b/src/analyze/analyze-fdstore.c @@ -26,7 +26,7 @@ static int dump_fdstore(sd_bus *bus, const char *arg) { assert(bus); assert(arg); - r = unit_name_mangle_with_suffix(arg, NULL, UNIT_NAME_MANGLE_GLOB, ".service", &unit); + r = unit_name_mangle_with_suffix(arg, /* operation= */ NULL, UNIT_NAME_MANGLE_GLOB, ".service", &unit); if (r < 0) return log_error_errno(r, "Failed to mangle name '%s': %m", arg); @@ -105,7 +105,7 @@ int verb_fdstore(int argc, char *argv[], uintptr_t _data, void *userdata) { _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL; int r; - r = acquire_bus(&bus, NULL); + r = acquire_bus(&bus, /* use_full_bus= */ NULL); if (r < 0) return bus_log_connect_error(r, arg_transport, arg_runtime_scope); diff --git a/src/analyze/analyze-inspect-elf.c b/src/analyze/analyze-inspect-elf.c index c664aea5886..0d5664f761b 100644 --- a/src/analyze/analyze-inspect-elf.c +++ b/src/analyze/analyze-inspect-elf.c @@ -116,7 +116,7 @@ static int analyze_elf(char **filenames, sd_json_format_flags_t json_flags) { } if (sd_json_format_enabled(json_flags)) - sd_json_variant_dump(package_metadata, json_flags, stdout, NULL); + sd_json_variant_dump(package_metadata, json_flags, stdout, /* prefix= */ NULL); else { r = table_print_or_warn(t); if (r < 0) diff --git a/src/analyze/analyze-log-control.c b/src/analyze/analyze-log-control.c index 13a58604368..8f95480601a 100644 --- a/src/analyze/analyze-log-control.c +++ b/src/analyze/analyze-log-control.c @@ -14,7 +14,7 @@ int verb_log_control(int argc, char *argv[], uintptr_t _data, void *userdata) { assert(IN_SET(argc, 1, 2)); - r = acquire_bus(&bus, NULL); + r = acquire_bus(&bus, /* use_full_bus= */ NULL); if (r < 0) return bus_log_connect_error(r, arg_transport, arg_runtime_scope); diff --git a/src/analyze/analyze-malloc.c b/src/analyze/analyze-malloc.c index c892b37ce31..9a81ce2cd23 100644 --- a/src/analyze/analyze-malloc.c +++ b/src/analyze/analyze-malloc.c @@ -27,7 +27,7 @@ static int dump_malloc_info(sd_bus *bus, char *service) { "GetMallocInfo", &error, &reply, - NULL); + /* types= */ NULL); if (r < 0) return log_error_errno(r, "Failed to call GetMallocInfo on '%s': %s", service, bus_error_message(&error, r)); @@ -47,7 +47,7 @@ int verb_malloc(int argc, char *argv[], uintptr_t _data, void *userdata) { services = args; } - r = acquire_bus(&bus, NULL); + r = acquire_bus(&bus, /* use_full_bus= */ NULL); if (r < 0) return bus_log_connect_error(r, arg_transport, arg_runtime_scope); diff --git a/src/analyze/analyze-nvpcrs.c b/src/analyze/analyze-nvpcrs.c index dde31be0732..a951670525e 100644 --- a/src/analyze/analyze-nvpcrs.c +++ b/src/analyze/analyze-nvpcrs.c @@ -67,8 +67,8 @@ int verb_nvpcrs(int argc, char *argv[], uintptr_t _data, void *userdata) { if (!table) return log_oom(); - (void) table_set_align_percent(table, table_get_cell(table, 0, 1), 100); - (void) table_set_align_percent(table, table_get_cell(table, 0, 2), 100); + (void) table_set_align_percent(table, table_get_cell(table, /* row= */ 0, 1), 100); + (void) table_set_align_percent(table, table_get_cell(table, /* row= */ 0, 2), 100); table_set_ersatz_string(table, TABLE_ERSATZ_DASH); (void) table_set_sort(table, (size_t) 2, (size_t) 0); diff --git a/src/analyze/analyze-pcrs.c b/src/analyze/analyze-pcrs.c index 7e3ddde800b..61044e2790f 100644 --- a/src/analyze/analyze-pcrs.c +++ b/src/analyze/analyze-pcrs.c @@ -80,7 +80,7 @@ static int add_pcr_to_table(Table *table, const char *alg, uint32_t pcr) { return log_oom(); /* Grey out PCRs that are not sensibly initialized */ - if (memeqbyte(0, buf, bufsize) || + if (memeqbyte(/* byte= */ 0, buf, bufsize) || memeqbyte(0xFFU, buf, bufsize)) color = ansi_grey(); } @@ -113,7 +113,7 @@ int verb_pcrs(int argc, char *argv[], uintptr_t _data, void *userdata) { if (!table) return log_oom(); - (void) table_set_align_percent(table, table_get_cell(table, 0, 0), 100); + (void) table_set_align_percent(table, table_get_cell(table, /* row= */ 0, /* column= */ 0), 100); table_set_ersatz_string(table, TABLE_ERSATZ_DASH); if (!alg) /* hide hash column if we couldn't acquire it */ diff --git a/src/analyze/analyze-plot.c b/src/analyze/analyze-plot.c index b1ed9bfa681..4cc7fcade9f 100644 --- a/src/analyze/analyze-plot.c +++ b/src/analyze/analyze-plot.c @@ -108,7 +108,7 @@ static int acquire_host_info(sd_bus *bus, HostInfo **hi) { hostname_map, BUS_MAP_STRDUP, &error, - NULL, + /* ret_reply= */ NULL, host); if (r < 0) { log_debug_errno(r, "Failed to get host information from systemd-hostnamed, ignoring: %s", @@ -124,7 +124,7 @@ manager: manager_map, BUS_MAP_STRDUP, &error, - NULL, + /* ret_reply= */ NULL, host); if (r < 0) return log_error_errno(r, "Failed to get host information from systemd: %s", @@ -320,7 +320,7 @@ static int produce_plot_as_svg( svg("%s", pretty_times); if (host) svg("%s %s (%s %s %s) %s %s", - os_release_pretty_name(host->os_pretty_name, NULL), + os_release_pretty_name(host->os_pretty_name, /* name= */ NULL), strempty(host->hostname), strempty(host->kernel_name), strempty(host->kernel_release), @@ -330,7 +330,7 @@ static int produce_plot_as_svg( svg("\n", 20.0 + (SCALE_X * boot->firmware_time)); if (boot->soft_reboots_count > 0) - svg_graph_box(m, 0, boot->finish_time); + svg_graph_box(m, /* begin= */ 0, boot->finish_time); else svg_graph_box(m, -(double) boot->firmware_time, boot->finish_time); diff --git a/src/analyze/analyze-security.c b/src/analyze/analyze-security.c index 3289ae8f47f..07ef06e7a08 100644 --- a/src/analyze/analyze-security.c +++ b/src/analyze/analyze-security.c @@ -1775,7 +1775,7 @@ static int assess(const SecurityInfo *info, if (!details_table) return log_oom(); - r = table_set_json_field_name(details_table, 0, "set"); + r = table_set_json_field_name(details_table, /* idx= */ 0, "set"); if (r < 0) return log_error_errno(r, "Failed to set JSON field name of column 0: %m"); @@ -2387,7 +2387,7 @@ static int acquire_security_info(sd_bus *bus, const char *name, SecurityInfo *in security_map, BUS_MAP_STRDUP | BUS_MAP_BOOLEAN_AS_BOOL, &error, - NULL, + /* ret_reply= */ NULL, info); if (r < 0) return log_error_errno(r, "Failed to get unit properties: %s", bus_error_message(&error, r)); @@ -2787,7 +2787,7 @@ static int offline_security_checks( profile = profile_path; } - r = copy_file(profile, dropin, 0, 0644, 0); + r = copy_file(profile, dropin, /* open_flags= */ 0, 0644, /* copy_flags= */ 0); if (r < 0) return log_error_errno(r, "Failed to copy: %m"); } @@ -2847,7 +2847,7 @@ static int analyze_security(sd_bus *bus, "ListUnits", &error, &reply, - NULL); + /* types= */ NULL); if (r < 0) return log_error_errno(r, "Failed to list units: %s", bus_error_message(&error, r)); @@ -2897,7 +2897,7 @@ static int analyze_security(sd_bus *bus, fflush(stdout); } - r = unit_name_mangle(*i, 0, &mangled); + r = unit_name_mangle(*i, /* flags= */ 0, &mangled); if (r < 0) return log_error_errno(r, "Failed to mangle unit name '%s': %m", *i); @@ -2939,7 +2939,7 @@ int verb_security(int argc, char *argv[], uintptr_t _data, void *userdata) { int r; if (!arg_offline) { - r = acquire_bus(&bus, NULL); + r = acquire_bus(&bus, /* use_full_bus= */ NULL); if (r < 0) return bus_log_connect_error(r, arg_transport, arg_runtime_scope); } diff --git a/src/analyze/analyze-service-watchdogs.c b/src/analyze/analyze-service-watchdogs.c index 4d27fef5330..859e70da321 100644 --- a/src/analyze/analyze-service-watchdogs.c +++ b/src/analyze/analyze-service-watchdogs.c @@ -19,7 +19,7 @@ int verb_service_watchdogs(int argc, char *argv[], uintptr_t _data, void *userda assert(IN_SET(argc, 1, 2)); assert(argv); - r = acquire_bus(&bus, NULL); + r = acquire_bus(&bus, /* use_full_bus= */ NULL); if (r < 0) return bus_log_connect_error(r, arg_transport, arg_runtime_scope); diff --git a/src/analyze/analyze-time-data.c b/src/analyze/analyze-time-data.c index f71be1e7a7f..95f4a2a26ee 100644 --- a/src/analyze/analyze-time-data.c +++ b/src/analyze/analyze-time-data.c @@ -85,7 +85,7 @@ int acquire_boot_times(sd_bus *bus, bool require_finished, BootTimes **ret) { property_map, BUS_MAP_STRDUP, &error, - NULL, + /* ret_reply= */ NULL, ×); if (r < 0) return log_error_errno(r, "Failed to get timestamp properties: %s", bus_error_message(&error, r)); @@ -330,7 +330,7 @@ int acquire_time_data(sd_bus *bus, bool require_finished, UnitTimes **out) { if (r < 0) return r; - r = bus_call_method(bus, bus_systemd_mgr, "ListUnits", &error, &reply, NULL); + r = bus_call_method(bus, bus_systemd_mgr, "ListUnits", &error, &reply, /* types= */ NULL); if (r < 0) return log_error_errno(r, "Failed to list units: %s", bus_error_message(&error, r)); @@ -357,7 +357,7 @@ int acquire_time_data(sd_bus *bus, bool require_finished, UnitTimes **out) { property_map, BUS_MAP_STRDUP, &error, - NULL, + /* ret_reply= */ NULL, t); if (r < 0) return log_error_errno(r, "Failed to get timestamp properties of unit %s: %s", diff --git a/src/analyze/analyze-time.c b/src/analyze/analyze-time.c index a4faee977f6..6030cd24462 100644 --- a/src/analyze/analyze-time.c +++ b/src/analyze/analyze-time.c @@ -14,7 +14,7 @@ int verb_time(int argc, char *argv[], uintptr_t _data, void *userdata) { _cleanup_free_ char *buf = NULL; int r; - r = acquire_bus(&bus, NULL); + r = acquire_bus(&bus, /* use_full_bus= */ NULL); if (r < 0) return bus_log_connect_error(r, arg_transport, arg_runtime_scope); diff --git a/src/analyze/analyze-timespan.c b/src/analyze/analyze-timespan.c index de78736e2ca..86339e69448 100644 --- a/src/analyze/analyze-timespan.c +++ b/src/analyze/analyze-timespan.c @@ -27,10 +27,10 @@ int verb_timespan(int argc, char *argv[], uintptr_t _data, void *userdata) { if (!table) return log_oom(); - assert_se(cell = table_get_cell(table, 0, 0)); + assert_se(cell = table_get_cell(table, /* row= */ 0, /* column= */ 0)); (void) table_set_ellipsize_percent(table, cell, 100); - assert_se(cell = table_get_cell(table, 0, 1)); + assert_se(cell = table_get_cell(table, /* row= */ 0, 1)); (void) table_set_ellipsize_percent(table, cell, 100); r = table_add_many(table, @@ -39,7 +39,7 @@ int verb_timespan(int argc, char *argv[], uintptr_t _data, void *userdata) { if (r < 0) return table_log_add_error(r); - r = table_add_cell_stringf_full(table, NULL, TABLE_FIELD, "%ss", glyph(GLYPH_MU)); + r = table_add_cell_stringf_full(table, /* ret_cell= */ NULL, TABLE_FIELD, "%ss", glyph(GLYPH_MU)); if (r < 0) return table_log_add_error(r); diff --git a/src/analyze/analyze-timestamp.c b/src/analyze/analyze-timestamp.c index 50cda12d718..6aac8dec740 100644 --- a/src/analyze/analyze-timestamp.c +++ b/src/analyze/analyze-timestamp.c @@ -26,10 +26,10 @@ static int test_timestamp_one(const char *p) { if (!table) return log_oom(); - assert_se(cell = table_get_cell(table, 0, 0)); + assert_se(cell = table_get_cell(table, /* row= */ 0, /* column= */ 0)); (void) table_set_ellipsize_percent(table, cell, 100); - assert_se(cell = table_get_cell(table, 0, 1)); + assert_se(cell = table_get_cell(table, /* row= */ 0, 1)); (void) table_set_ellipsize_percent(table, cell, 100); r = table_add_many(table, @@ -49,7 +49,7 @@ static int test_timestamp_one(const char *p) { return table_log_add_error(r); } - r = table_add_cell(table, NULL, TABLE_FIELD, "UNIX seconds"); + r = table_add_cell(table, /* ret_cell= */ NULL, TABLE_FIELD, "UNIX seconds"); if (r < 0) return table_log_add_error(r); diff --git a/src/analyze/analyze-unit-files.c b/src/analyze/analyze-unit-files.c index a15815ddcc0..67387484c3b 100644 --- a/src/analyze/analyze-unit-files.c +++ b/src/analyze/analyze-unit-files.c @@ -29,11 +29,11 @@ int verb_unit_files(int argc, char *argv[], uintptr_t _data, void *userdata) { char **v; int r; - r = lookup_paths_init_or_warn(&lp, arg_runtime_scope, 0, NULL); + r = lookup_paths_init_or_warn(&lp, arg_runtime_scope, /* flags= */ 0, /* root_dir= */ NULL); if (r < 0) return r; - r = unit_file_build_name_map(&lp, NULL, &unit_ids, &unit_names, NULL); + r = unit_file_build_name_map(&lp, /* cache_timestamp_hash= */ NULL, &unit_ids, &unit_names, /* path_cache= */ NULL); if (r < 0) return log_error_errno(r, "unit_file_build_name_map() failed: %m"); diff --git a/src/analyze/analyze-unit-paths.c b/src/analyze/analyze-unit-paths.c index 3903166bf29..101fdbc3f94 100644 --- a/src/analyze/analyze-unit-paths.c +++ b/src/analyze/analyze-unit-paths.c @@ -11,7 +11,7 @@ int verb_unit_paths(int argc, char *argv[], uintptr_t _data, void *userdata) { _cleanup_(lookup_paths_done) LookupPaths paths = {}; int r; - r = lookup_paths_init_or_warn(&paths, arg_runtime_scope, 0, NULL); + r = lookup_paths_init_or_warn(&paths, arg_runtime_scope, /* flags= */ 0, /* root_dir= */ NULL); if (r < 0) return r; diff --git a/src/analyze/analyze-verify-util.c b/src/analyze/analyze-verify-util.c index eed997ce45a..66085d53f3c 100644 --- a/src/analyze/analyze-verify-util.c +++ b/src/analyze/analyze-verify-util.c @@ -198,7 +198,7 @@ int verify_executable(Unit *u, const ExecCommand *exec, const char *root) { if (exec->flags & EXEC_COMMAND_IGNORE_FAILURE) return 0; - r = find_executable_full(exec->path, root, NULL, false, NULL, NULL); + r = find_executable_full(exec->path, root, /* exec_search_path= */ NULL, /* use_path_envvar= */ false, /* ret_filename= */ NULL, /* ret_fd= */ NULL); if (r < 0) return log_unit_error_errno(u, r, "Command %s is not executable: %m", exec->path); @@ -230,7 +230,7 @@ static int verify_documentation(Unit *u, bool check_man) { log_unit_debug(u, "Found documentation item: %s", *p); if (check_man && startswith(*p, "man:")) { - k = show_man_page(*p + 4, true); + k = show_man_page(*p + 4, /* null_stdio= */ true); if (k != 0) { if (k < 0) { const char *hint = ""; diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c index 86add95ebb3..c66e3e1834b 100644 --- a/src/analyze/analyze-verify.c +++ b/src/analyze/analyze-verify.c @@ -46,7 +46,7 @@ static int process_aliases(char *argv[], char *tempdir, char ***ret) { if (!dst) return -ENOMEM; - r = copy_file(src, dst, 0, 0644, /* copy_flags= */ 0); + r = copy_file(src, dst, /* open_flags= */ 0, 0644, /* copy_flags= */ 0); if (r < 0) return r; diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index ffc0c2391c9..016e3a9c020 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -163,13 +163,13 @@ int bus_get_unit_property_strv(sd_bus *bus, const char *path, const char *proper } void time_parsing_hint(const char *p, bool calendar, bool timestamp, bool timespan) { - if (calendar && calendar_spec_from_string(p, NULL) >= 0) + if (calendar && calendar_spec_from_string(p, /* ret= */ NULL) >= 0) log_notice("Hint: this expression is a valid calendar specification. " "Use 'systemd-analyze calendar \"%s\"' instead?", p); - if (timestamp && parse_timestamp(p, NULL) >= 0) + if (timestamp && parse_timestamp(p, /* ret= */ NULL) >= 0) log_notice("Hint: this expression is a valid timestamp. " "Use 'systemd-analyze timestamp \"%s\"' instead?", p); - if (timespan && parse_time(p, NULL, USEC_PER_SEC) >= 0) + if (timespan && parse_time(p, /* ret= */ NULL, USEC_PER_SEC) >= 0) log_notice("Hint: this expression is a valid timespan. " "Use 'systemd-analyze timespan \"%s\"' instead?", p); } diff --git a/src/analyze/test-verify.c b/src/analyze/test-verify.c index 04a24ba928c..36965d43bfa 100644 --- a/src/analyze/test-verify.c +++ b/src/analyze/test-verify.c @@ -16,12 +16,12 @@ const char *arg_instance = "test_instance"; TEST(verify_nonexistent) { /* Negative cases */ - assert_se(verify_executable(NULL, &(ExecCommand) {.flags = EXEC_COMMAND_IGNORE_FAILURE, .path = (char*) "/non/existent"}, NULL) == 0); - assert_se(verify_executable(NULL, &(ExecCommand) {.path = (char*) "/non/existent"}, NULL) < 0); + assert_se(verify_executable(NULL, &(ExecCommand) {.flags = EXEC_COMMAND_IGNORE_FAILURE, .path = (char*) "/non/existent"}, /* root= */ NULL) == 0); + assert_se(verify_executable(NULL, &(ExecCommand) {.path = (char*) "/non/existent"}, /* root= */ NULL) < 0); /* Ordinary cases */ - assert_se(verify_executable(NULL, &(ExecCommand) {.path = (char*) "/bin/echo"}, NULL) == 0); - assert_se(verify_executable(NULL, &(ExecCommand) {.flags = EXEC_COMMAND_IGNORE_FAILURE, .path = (char*) "/bin/echo"}, NULL) == 0); + assert_se(verify_executable(NULL, &(ExecCommand) {.path = (char*) "/bin/echo"}, /* root= */ NULL) == 0); + assert_se(verify_executable(NULL, &(ExecCommand) {.flags = EXEC_COMMAND_IGNORE_FAILURE, .path = (char*) "/bin/echo"}, /* root= */ NULL) == 0); } static void test_verify_set_unit_path_one(const char *old, const char *expected) { @@ -52,12 +52,12 @@ TEST(verify_set_unit_path) { _cleanup_free_ char *old_saved = getenv("SYSTEMD_UNIT_PATH") ? strdup(getenv("SYSTEMD_UNIT_PATH")) : NULL; ASSERT_TRUE(old_saved || !getenv("SYSTEMD_UNIT_PATH")); - test_verify_set_unit_path_one(NULL, ":"); + test_verify_set_unit_path_one(/* old= */ NULL, ":"); test_verify_set_unit_path_one("", ""); test_verify_set_unit_path_one(":", ":"); test_verify_set_unit_path_one("/foo:", ":/foo:"); - test_verify_set_unit_path_one(":foo", NULL); - test_verify_set_unit_path_one("/foo::/bar", NULL); + test_verify_set_unit_path_one(":foo", /* expected= */ NULL); + test_verify_set_unit_path_one("/foo::/bar", /* expected= */ NULL); if (old_saved) ASSERT_OK_ERRNO(setenv("SYSTEMD_UNIT_PATH", old_saved, 1));