From 3fb8c0f614ab0cb3da649e6ca275abfa7ffc9a34 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 19 Nov 2022 11:14:07 +0100 Subject: [PATCH] clang-format: reformat code with clang-format 15.0.4-1.fc37 This is the version shipped in Fedora 37. As Fedora 37 is now out, the core developers switch to it. Our gitlab-ci will also use that as base image for the check-{patch.tree} tests and to generate the pages. There is a need that everybody agrees on which clang-format version to use, and that version should be the one of the currently used Fedora release. Also update the used Fedora image in "contrib/scripts/nm-code-format-container.sh" script. The gitlab-ci still needs update in the following commit. The change in isolation will break the "check-tree" test. --- contrib/scripts/nm-code-format-container.sh | 2 +- src/core/devices/nm-device-factory.h | 3 +- src/core/devices/ovs/nm-ovsdb.c | 6 ++-- src/core/dhcp/nm-dhcp-client.c | 2 +- src/core/dhcp/nm-dhcp-utils.c | 2 +- src/core/dhcp/tests/test-dhcp-utils.c | 34 +++++++++---------- src/core/nm-config.c | 28 +++++++-------- src/core/nm-core-utils.c | 4 +-- src/core/platform/tests/monitor.c | 6 ++-- src/core/platform/tests/test-common.c | 8 ++--- src/core/platform/tests/test-route.c | 2 +- .../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 10 +++--- src/core/tests/config/test-config.c | 6 ++-- src/core/tests/test-core-with-expect.c | 10 +++--- src/libnm-client-impl/tests/test-libnm.c | 2 +- src/libnm-core-impl/nm-team-utils.c | 4 +-- src/libnm-core-impl/tests/test-general.c | 14 ++++---- src/libnm-glib-aux/nm-macros-internal.h | 14 ++++---- src/libnm-glib-aux/nm-test-utils.h | 3 +- .../tests/test-shared-general.c | 4 +-- src/libnm-platform/nm-linux-platform.c | 6 ++-- src/libnmc-base/nm-vpn-helpers.c | 14 ++++---- src/nm-dispatcher/nm-dispatcher.c | 30 ++++++++-------- src/nm-initrd-generator/nm-initrd-generator.c | 16 ++++----- src/nm-initrd-generator/nmi-cmdline-reader.c | 4 +-- src/nm-online/nm-online.c | 10 +++--- src/nmcli/common.c | 2 +- src/nmtui/nmt-password-fields.c | 8 ++--- 28 files changed, 128 insertions(+), 126 deletions(-) diff --git a/contrib/scripts/nm-code-format-container.sh b/contrib/scripts/nm-code-format-container.sh index 0ffcd7c731..9d9643832f 100755 --- a/contrib/scripts/nm-code-format-container.sh +++ b/contrib/scripts/nm-code-format-container.sh @@ -10,7 +10,7 @@ die() { DIR="$(realpath "$(dirname "$0")/../../")" cd "$DIR" -FEDORA_VERSION=36 +FEDORA_VERSION=37 PODNAME="nm-code-format-f$FEDORA_VERSION" diff --git a/src/core/devices/nm-device-factory.h b/src/core/devices/nm-device-factory.h index 51d6476700..e23f6fd781 100644 --- a/src/core/devices/nm-device-factory.h +++ b/src/core/devices/nm-device-factory.h @@ -208,7 +208,8 @@ NMDevice *nm_device_factory_create_device(NMDeviceFactory *factory, \ NM_DEVICE_FACTORY_DECLARE_TYPES(st_code) \ \ - static void nm_##lower##_device_factory_init(NM##mixed##DeviceFactory *self) {} \ + static void nm_##lower##_device_factory_init(NM##mixed##DeviceFactory *self) \ + {} \ \ static void nm_##lower##_device_factory_class_init(NM##mixed##DeviceFactoryClass *klass) \ { \ diff --git a/src/core/devices/ovs/nm-ovsdb.c b/src/core/devices/ovs/nm-ovsdb.c index 9242f70b89..1c50e42f61 100644 --- a/src/core/devices/ovs/nm-ovsdb.c +++ b/src/core/devices/ovs/nm-ovsdb.c @@ -1602,7 +1602,7 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg) json_t *items; json_t *external_ids; json_error_t json_error = { - 0, + 0, }; void *iter; const char *name; @@ -2003,7 +2003,7 @@ ovsdb_got_msg(NMOvsdb *self, json_t *msg) { NMOvsdbPrivate *priv = NM_OVSDB_GET_PRIVATE(self); json_error_t json_error = { - 0, + 0, }; json_t *json_id = NULL; json_int_t id = (json_int_t) -1; @@ -2145,7 +2145,7 @@ ovsdb_read_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) gssize size; json_t *msg; json_error_t json_error = { - 0, + 0, }; size = g_input_stream_read_finish(stream, res, &error); diff --git a/src/core/dhcp/nm-dhcp-client.c b/src/core/dhcp/nm-dhcp-client.c index 19a44c6ac6..88548b122a 100644 --- a/src/core/dhcp/nm-dhcp-client.c +++ b/src/core/dhcp/nm-dhcp-client.c @@ -1576,7 +1576,7 @@ nm_dhcp_client_handle_event(gpointer unused, nm_auto_unref_l3cd_init NML3ConfigData *l3cd = NULL; NMDhcpClientEventType client_event_type; NMPlatformIP6Address prefix = { - 0, + 0, }; g_return_val_if_fail(NM_IS_DHCP_CLIENT(self), FALSE); diff --git a/src/core/dhcp/nm-dhcp-utils.c b/src/core/dhcp/nm-dhcp-utils.c index b9a787488e..ca1c04829b 100644 --- a/src/core/dhcp/nm-dhcp-utils.c +++ b/src/core/dhcp/nm-dhcp-utils.c @@ -593,7 +593,7 @@ nm_dhcp_utils_ip6_prefix_from_options(GHashTable *options) { gs_strfreev char **split_addr = NULL; NMPlatformIP6Address address = { - 0, + 0, }; struct in6_addr tmp_addr; char *str = NULL; diff --git a/src/core/dhcp/tests/test-dhcp-utils.c b/src/core/dhcp/tests/test-dhcp-utils.c index 285943132a..1c6d6302b9 100644 --- a/src/core/dhcp/tests/test-dhcp-utils.c +++ b/src/core/dhcp/tests/test-dhcp-utils.c @@ -284,7 +284,7 @@ test_classless_static_routes_1(void) const char *expected_route2_dest = "10.0.0.0"; const char *expected_route2_gw = "10.17.66.41"; static const Option data[] = { - /* dhclient custom format */ + /* dhclient custom format */ {"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 8 10 10 17 66 41"}, {NULL, NULL}}; @@ -309,7 +309,7 @@ test_classless_static_routes_2(void) const char *expected_route2_dest = "10.0.0.0"; const char *expected_route2_gw = "10.17.66.41"; static const Option data[] = { - /* dhcpcd format */ + /* dhcpcd format */ {"classless_static_routes", "192.168.10.0/24 192.168.1.1 10.0.0.0/8 10.17.66.41"}, {NULL, NULL}}; @@ -335,7 +335,7 @@ test_fedora_dhclient_classless_static_routes(void) const char *expected_route2_gw = "10.34.255.6"; const char *expected_gateway = "192.168.0.113"; static const Option data[] = { - /* Fedora dhclient format */ + /* Fedora dhclient format */ {"classless_static_routes", "0 192.168.0.113 25.129.210.177.132 192.168.0.113 7.2 10.34.255.6"}, {NULL, NULL}}; @@ -361,7 +361,7 @@ test_dhclient_invalid_classless_routes_1(void) const char *expected_route1_dest = "192.168.10.0"; const char *expected_route1_gw = "192.168.1.1"; static const Option data[] = { - /* dhclient format */ + /* dhclient format */ {"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 45 10 17 66 41"}, {NULL, NULL}}; @@ -388,7 +388,7 @@ test_dhcpcd_invalid_classless_routes_1(void) const char *expected_route2_dest = "100.99.88.56"; const char *expected_route2_gw = "10.1.1.1"; static const Option data[] = { - /* dhcpcd format */ + /* dhcpcd format */ {"classless_static_routes", "192.168.10.0/24 192.168.1.1 10.0.adfadf/44 10.17.66.41"}, {NULL, NULL}}; @@ -418,8 +418,8 @@ test_dhclient_invalid_classless_routes_2(void) const char *expected_route2_dest = "100.99.88.56"; const char *expected_route2_gw = "10.1.1.1"; static const Option data[] = { - {"rfc3442_classless_static_routes", "45 10 17 66 41 24 192 168 10 192 168 1 1"}, - {NULL, NULL}}; + {"rfc3442_classless_static_routes", "45 10 17 66 41 24 192 168 10 192 168 1 1"}, + {NULL, NULL}}; options = fill_table(generic_options, NULL); options = fill_table(data, options); @@ -447,8 +447,8 @@ test_dhcpcd_invalid_classless_routes_2(void) const char *expected_route2_dest = "100.99.88.56"; const char *expected_route2_gw = "10.1.1.1"; static const Option data[] = { - {"classless_static_routes", "10.0.adfadf/44 10.17.66.41 192.168.10.0/24 192.168.1.1"}, - {NULL, NULL}}; + {"classless_static_routes", "10.0.adfadf/44 10.17.66.41 192.168.10.0/24 192.168.1.1"}, + {NULL, NULL}}; options = fill_table(generic_options, NULL); options = fill_table(data, options); @@ -476,8 +476,8 @@ test_dhclient_invalid_classless_routes_3(void) const char *expected_route1_dest = "192.168.10.0"; const char *expected_route1_gw = "192.168.1.1"; static const Option data[] = { - {"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 32 128 10 17 66 41"}, - {NULL, NULL}}; + {"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 32 128 10 17 66 41"}, + {NULL, NULL}}; options = fill_table(generic_options, NULL); options = fill_table(data, options); @@ -500,8 +500,8 @@ test_dhcpcd_invalid_classless_routes_3(void) const char *expected_route1_dest = "192.168.10.0"; const char *expected_route1_gw = "192.168.1.1"; static Option data[] = { - {"classless_static_routes", "192.168.10.0/24 192.168.1.1 128/32 10.17.66.41"}, - {NULL, NULL}}; + {"classless_static_routes", "192.168.10.0/24 192.168.1.1 128/32 10.17.66.41"}, + {NULL, NULL}}; options = fill_table(generic_options, NULL); options = fill_table(data, options); @@ -525,8 +525,8 @@ test_dhclient_gw_in_classless_routes(void) const char *expected_route1_gw = "192.168.1.1"; const char *expected_gateway = "192.2.3.4"; static Option data[] = { - {"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 0 192 2 3 4"}, - {NULL, NULL}}; + {"rfc3442_classless_static_routes", "24 192 168 10 192 168 1 1 0 192 2 3 4"}, + {NULL, NULL}}; options = fill_table(generic_options, NULL); options = fill_table(data, options); @@ -549,8 +549,8 @@ test_dhcpcd_gw_in_classless_routes(void) const char *expected_route1_gw = "192.168.1.1"; const char *expected_gateway = "192.2.3.4"; static Option data[] = { - {"classless_static_routes", "192.168.10.0/24 192.168.1.1 0.0.0.0/0 192.2.3.4"}, - {NULL, NULL}}; + {"classless_static_routes", "192.168.10.0/24 192.168.1.1 0.0.0.0/0 192.2.3.4"}, + {NULL, NULL}}; options = fill_table(generic_options, NULL); options = fill_table(data, options); diff --git a/src/core/nm-config.c b/src/core/nm-config.c index db8f08bf09..807399783c 100644 --- a/src/core/nm-config.c +++ b/src/core/nm-config.c @@ -575,63 +575,63 @@ nm_config_cmd_line_options_add_to_entries(NMConfigCmdLineOptions *cli, GOptionCo { GOptionGroup *group; GOptionEntry config_options[] = { - {"config", + {"config", 0, 0, G_OPTION_ARG_FILENAME, &cli->config_main_file, N_("Config file location"), DEFAULT_CONFIG_MAIN_FILE}, - {"config-dir", + {"config-dir", 0, 0, G_OPTION_ARG_FILENAME, &cli->config_dir, N_("Config directory location"), DEFAULT_CONFIG_DIR}, - {"system-config-dir", + {"system-config-dir", 0, 0, G_OPTION_ARG_FILENAME, &cli->system_config_dir, N_("System config directory location"), DEFAULT_SYSTEM_CONFIG_DIR}, - {"intern-config", + {"intern-config", 0, 0, G_OPTION_ARG_FILENAME, &cli->intern_config_file, N_("Internal config file location"), DEFAULT_INTERN_CONFIG_FILE}, - {"state-file", + {"state-file", 0, 0, G_OPTION_ARG_FILENAME, &cli->state_file, N_("State file location"), DEFAULT_STATE_FILE}, - {"no-auto-default", + {"no-auto-default", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_FILENAME, &cli->no_auto_default_file, N_("State file for no-auto-default devices"), DEFAULT_NO_AUTO_DEFAULT_FILE}, - {"plugins", + {"plugins", 0, 0, G_OPTION_ARG_STRING, &cli->plugins, N_("List of plugins separated by ','"), NM_CONFIG_DEFAULT_MAIN_PLUGINS}, - {"configure-and-quit", + {"configure-and-quit", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, parse_configure_and_quit, N_("Quit after initial configuration"), NULL}, - {"debug", + {"debug", 'd', 0, G_OPTION_ARG_NONE, @@ -639,29 +639,29 @@ nm_config_cmd_line_options_add_to_entries(NMConfigCmdLineOptions *cli, GOptionCo N_("Don't become a daemon, and log to stderr"), NULL}, - /* These three are hidden for now, and should eventually just go away. */ - {"connectivity-uri", + /* These three are hidden for now, and should eventually just go away. */ + {"connectivity-uri", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &cli->connectivity_uri, N_("An http(s) address for checking internet connectivity"), "http://example.com"}, - {"connectivity-interval", + {"connectivity-interval", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_INT, &cli->connectivity_interval, N_("The interval between connectivity checks (in seconds)"), G_STRINGIFY(NM_CONFIG_DEFAULT_CONNECTIVITY_INTERVAL)}, - {"connectivity-response", + {"connectivity-response", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &cli->connectivity_response, N_("The expected start of the response"), NM_CONFIG_DEFAULT_CONNECTIVITY_RESPONSE}, - {0}, + {0}, }; g_return_if_fail(opt_ctx); diff --git a/src/core/nm-core-utils.c b/src/core/nm-core-utils.c index 5a6e16c0fe..967fe78b4e 100644 --- a/src/core/nm-core-utils.c +++ b/src/core/nm-core-utils.c @@ -3863,7 +3863,7 @@ nm_utils_dhcp_client_id_duid(guint32 iaid, const guint8 *duid, gsize duid_len) guint8 type; guint32 iaid; guint8 duid[]; - } * client_id; + } *client_id; gsize total_size; /* the @duid must include the 16 bit duid-type and the data (of max 128 bytes). */ @@ -3913,7 +3913,7 @@ nm_utils_dhcp_client_id_systemd_node_specific_full(guint32 iaid, } en; }; } duid; - } * client_id; + } *client_id; guint64 u64; g_return_val_if_fail(machine_id, NULL); diff --git a/src/core/platform/tests/monitor.c b/src/core/platform/tests/monitor.c index 5c14331c02..c83192bbc9 100644 --- a/src/core/platform/tests/monitor.c +++ b/src/core/platform/tests/monitor.c @@ -43,21 +43,21 @@ read_argv(int *argc, char ***argv) { GOptionContext *context; GOptionEntry options[] = { - {"no-persist", + {"no-persist", 'P', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &global_opt.persist, "Exit after processing netlink messages", NULL}, - {"state-file", + {"state-file", 'S', 0, G_OPTION_ARG_FILENAME, &global_opt.state_file, "Dump the platform cache to this file", "FILE"}, - {0}, + {0}, }; gs_free_error GError *error = NULL; diff --git a/src/core/platform/tests/test-common.c b/src/core/platform/tests/test-common.c index 5049bc5189..5c0484d914 100644 --- a/src/core/platform/tests/test-common.c +++ b/src/core/platform/tests/test-common.c @@ -1934,10 +1934,10 @@ nmtstp_link_macvlan_add(NMPlatform *platform, if (external_command) { const char *dev; char *modes[] = { - [MACVLAN_MODE_BRIDGE] = "bridge", - [MACVLAN_MODE_VEPA] = "vepa", - [MACVLAN_MODE_PRIVATE] = "private", - [MACVLAN_MODE_PASSTHRU] = "passthru", + [MACVLAN_MODE_BRIDGE] = "bridge", + [MACVLAN_MODE_VEPA] = "vepa", + [MACVLAN_MODE_PRIVATE] = "private", + [MACVLAN_MODE_PASSTHRU] = "passthru", }; dev = nm_platform_link_get_name(platform, parent); diff --git a/src/core/platform/tests/test-route.c b/src/core/platform/tests/test-route.c index 1bf6eb5162..de34cfaef1 100644 --- a/src/core/platform/tests/test-route.c +++ b/src/core/platform/tests/test-route.c @@ -1176,7 +1176,7 @@ _rule_check_kernel_support(NMPlatform *platform, int attribute) .addr_family = AF_INET, .priority = PROBE_PRORITY, .uid_range = - { + { .start = 0, .end = 0, }, diff --git a/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index 108c6ccd57..8324be648c 100644 --- a/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -2049,11 +2049,11 @@ test_read_wired_aliases_good(gconstpointer test_data) NULL}; const char *expected_address_3[] = {"192.168.1.5", "192.168.1.6", NULL}; const char *expected_label_0[] = { - NULL, - "aliasem0:1", - "aliasem0:2", - "aliasem0:99", - NULL, + NULL, + "aliasem0:1", + "aliasem0:2", + "aliasem0:99", + NULL, }; const char *expected_label_3[] = { NULL, diff --git a/src/core/tests/config/test-config.c b/src/core/tests/config/test-config.c index 17a66b06e6..fa7fae0757 100644 --- a/src/core/tests/config/test-config.c +++ b/src/core/tests/config/test-config.c @@ -1103,9 +1103,9 @@ test_config_set_values(void) const char *CONFIG_USER = BUILD_DIR "/test-set-values-user.conf"; const char *CONFIG_INTERN = BUILD_DIR "/test-set-values-intern.conf"; const char *atomic_section_prefixes[] = { - "atomic-prefix-1.", - "atomic-prefix-2.", - NULL, + "atomic-prefix-1.", + "atomic-prefix-2.", + NULL, }; g_assert(g_file_set_contents(CONFIG_USER, "", 0, NULL)); diff --git a/src/core/tests/test-core-with-expect.c b/src/core/tests/test-core-with-expect.c index 0aba30dd57..4e6ee9e4c3 100644 --- a/src/core/tests/test-core-with-expect.c +++ b/src/core/tests/test-core-with-expect.c @@ -227,11 +227,11 @@ do_test_nm_utils_kill_child(void) { GLogLevelFlags fatal_mask; char *argv_watchdog[] = { - "bash", - "-c", - "sleep 4; " - "kill -KILL 0; #watchdog for #" TEST_TOKEN, - NULL, + "bash", + "-c", + "sleep 4; " + "kill -KILL 0; #watchdog for #" TEST_TOKEN, + NULL, }; char *argv1[] = { "bash", diff --git a/src/libnm-client-impl/tests/test-libnm.c b/src/libnm-client-impl/tests/test-libnm.c index 1810e139e9..456f185561 100644 --- a/src/libnm-client-impl/tests/test-libnm.c +++ b/src/libnm-client-impl/tests/test-libnm.c @@ -3099,7 +3099,7 @@ check_dbus_properties: const struct { const char *dbus_type; GType default_gtype; - } * p_expected_type, *p_expected_type_2, + } *p_expected_type, *p_expected_type_2, expected_types[] = { {"b", G_TYPE_BOOLEAN}, {"q", G_TYPE_UINT}, {"y", G_TYPE_UCHAR}, {"i", G_TYPE_INT}, diff --git a/src/libnm-core-impl/nm-team-utils.c b/src/libnm-core-impl/nm-team-utils.c index 6d87f50bb2..2f62f6c613 100644 --- a/src/libnm-core-impl/nm-team-utils.c +++ b/src/libnm-core-impl/nm-team-utils.c @@ -2148,11 +2148,11 @@ nm_team_setting_config_set(NMTeamSetting *self, const char *js_str) else { gboolean unrecognized_content = FALSE; bool has_lst[_NM_TEAM_ATTRIBUTE_NUM] = { - FALSE, + FALSE, }; NMValueTypUnion val_lst[_NM_TEAM_ATTRIBUTE_NUM]; nm_json_t *found_keys[_NM_TEAM_ATTRIBUTE_NUM] = { - NULL, + NULL, }; gs_unref_ptrarray GPtrArray *ptr_array_master_runner_tx_hash_free = NULL; gs_unref_ptrarray GPtrArray *ptr_array_link_watchers_free = NULL; diff --git a/src/libnm-core-impl/tests/test-general.c b/src/libnm-core-impl/tests/test-general.c index 274330af26..f7602f5422 100644 --- a/src/libnm-core-impl/tests/test-general.c +++ b/src/libnm-core-impl/tests/test-general.c @@ -4052,11 +4052,11 @@ test_connection_diff_different(void) NMSettingIPConfig *s_ip4; gboolean same; const DiffSetting settings[] = { - {NM_SETTING_IP4_CONFIG_SETTING_NAME, + {NM_SETTING_IP4_CONFIG_SETTING_NAME, { - {NM_SETTING_IP_CONFIG_METHOD, + {NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_DIFF_RESULT_IN_A | NM_SETTING_DIFF_RESULT_IN_B}, - {NULL, NM_SETTING_DIFF_RESULT_UNKNOWN}, + {NULL, NM_SETTING_DIFF_RESULT_UNKNOWN}, }}, }; @@ -4137,10 +4137,10 @@ test_connection_diff_inferrable(void) NMSettingIPConfig *s_ip4; char *uuid; const DiffSetting settings[] = { - {NM_SETTING_CONNECTION_SETTING_NAME, + {NM_SETTING_CONNECTION_SETTING_NAME, { - {NM_SETTING_CONNECTION_INTERFACE_NAME, NM_SETTING_DIFF_RESULT_IN_A}, - {NULL, NM_SETTING_DIFF_RESULT_UNKNOWN}, + {NM_SETTING_CONNECTION_INTERFACE_NAME, NM_SETTING_DIFF_RESULT_IN_A}, + {NULL, NM_SETTING_DIFF_RESULT_UNKNOWN}, }}, }; @@ -8475,7 +8475,7 @@ test_nm_utils_strstrdictkey(void) const char *v1; const char *v2; NMUtilsStrStrDictKey *v_static; - } * val1, *val2, + } *val1, *val2, values[] = { {NULL, NULL}, {"", NULL}, diff --git a/src/libnm-glib-aux/nm-macros-internal.h b/src/libnm-glib-aux/nm-macros-internal.h index ae132e8737..085a27ff54 100644 --- a/src/libnm-glib-aux/nm-macros-internal.h +++ b/src/libnm-glib-aux/nm-macros-internal.h @@ -1010,15 +1010,15 @@ nm_g_variant_equal(GVariant *a, GVariant *b) const typeof(flags) _flags = (flags); \ const typeof(flags) _val = (val); \ \ - _flags &(~_val); \ + _flags & (~_val); \ }) -#define NM_FLAGS_ASSIGN(flags, val, assign) \ - ({ \ - const typeof(flags) _flags = (flags); \ - const typeof(flags) _val = (val); \ - \ - (assign) ? _flags | (_val) : _flags &(~_val); \ +#define NM_FLAGS_ASSIGN(flags, val, assign) \ + ({ \ + const typeof(flags) _flags = (flags); \ + const typeof(flags) _val = (val); \ + \ + (assign) ? _flags | (_val) : _flags & (~_val); \ }) #define NM_FLAGS_ASSIGN_MASK(flags, mask, val) \ diff --git a/src/libnm-glib-aux/nm-test-utils.h b/src/libnm-glib-aux/nm-test-utils.h index bfa441541a..114dd76c27 100644 --- a/src/libnm-glib-aux/nm-test-utils.h +++ b/src/libnm-glib-aux/nm-test-utils.h @@ -2723,7 +2723,8 @@ _nmtst_variant_new_vardict(int dummy, ...) G_STMT_END #else #define _nmtst_assert_variant_bytestring_cmp_str(_ptr, _ptr2, _len) \ - G_STMT_START {} \ + G_STMT_START \ + {} \ G_STMT_END #endif diff --git a/src/libnm-glib-aux/tests/test-shared-general.c b/src/libnm-glib-aux/tests/test-shared-general.c index dc04c3d5c0..7503dc9b9f 100644 --- a/src/libnm-glib-aux/tests/test-shared-general.c +++ b/src/libnm-glib-aux/tests/test-shared-general.c @@ -153,8 +153,8 @@ test_make_strv(void) const char *const *v2a = NM_MAKE_STRV("a", "b"); const char *const *v2b = NM_MAKE_STRV("a", "b", ); const char *const v3[] = { - "a", - "b", + "a", + "b", }; const char *const *v4b = NM_MAKE_STRV("a", _make_strv_foo(), ); diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c index a7442e4acc..8734aa7fd2 100644 --- a/src/libnm-platform/nm-linux-platform.c +++ b/src/libnm-platform/nm-linux-platform.c @@ -5572,7 +5572,7 @@ _nl_msg_new_tfilter(uint16_t nlmsg_type, uint16_t nlmsg_flags, const NMPlatformT if (nm_streq(action->kind, NM_PLATFORM_ACTION_KIND_SIMPLE)) { const NMPlatformActionSimple *simple = &action->simple; struct tc_defact sel = { - 0, + 0, }; if (!(act_options = nla_nest_start(msg, TCA_ACT_OPTIONS))) @@ -5586,7 +5586,7 @@ _nl_msg_new_tfilter(uint16_t nlmsg_type, uint16_t nlmsg_flags, const NMPlatformT } else if (nm_streq(action->kind, NM_PLATFORM_ACTION_KIND_MIRRED)) { const NMPlatformActionMirred *mirred = &action->mirred; struct tc_mirred sel = { - 0, + 0, }; if (!(act_options = nla_nest_start(msg, TCA_ACT_OPTIONS))) @@ -8319,7 +8319,7 @@ link_set_address(NMPlatform *platform, int ifindex, gconstpointer address, size_ nm_auto_nlmsg struct nl_msg *nlmsg = NULL; const ChangeLinkData d = { .set_address = - { + { .address = address, .length = length, }, diff --git a/src/libnmc-base/nm-vpn-helpers.c b/src/libnmc-base/nm-vpn-helpers.c index 7ad5bee509..476fbe518e 100644 --- a/src/libnmc-base/nm-vpn-helpers.c +++ b/src/libnmc-base/nm-vpn-helpers.c @@ -199,13 +199,13 @@ nm_vpn_openconnect_authenticate_helper(const char *host, const char *const *iter; const char *path; const char *const DEFAULT_PATHS[] = { - "/sbin/", - "/usr/sbin/", - "/usr/local/sbin/", - "/bin/", - "/usr/bin/", - "/usr/local/bin/", - NULL, + "/sbin/", + "/usr/sbin/", + "/usr/local/sbin/", + "/bin/", + "/usr/bin/", + "/usr/local/bin/", + NULL, }; path = nm_utils_file_search_in_paths("openconnect", diff --git a/src/nm-dispatcher/nm-dispatcher.c b/src/nm-dispatcher/nm-dispatcher.c index b6fc941af7..80fe40a0d6 100644 --- a/src/nm-dispatcher/nm-dispatcher.c +++ b/src/nm-dispatcher/nm-dispatcher.c @@ -1138,25 +1138,25 @@ _initial_setup(int *p_argc, char ***p_argv, GError **error) GOptionContext *opt_ctx; gboolean arg_debug = FALSE; GOptionEntry entries[] = {{ - "debug", - 0, - 0, - G_OPTION_ARG_NONE, - &arg_debug, - "Output to console rather than syslog", - NULL, + "debug", + 0, + 0, + G_OPTION_ARG_NONE, + &arg_debug, + "Output to console rather than syslog", + NULL, }, { - "persist", - 0, - 0, - G_OPTION_ARG_NONE, - &gl.persist, - "Don't quit after a short timeout", - NULL, + "persist", + 0, + 0, + G_OPTION_ARG_NONE, + &gl.persist, + "Don't quit after a short timeout", + NULL, }, { - NULL, + NULL, }}; gboolean success; diff --git a/src/nm-initrd-generator/nm-initrd-generator.c b/src/nm-initrd-generator/nm-initrd-generator.c index cff678f84e..d84e95e5ec 100644 --- a/src/nm-initrd-generator/nm-initrd-generator.c +++ b/src/nm-initrd-generator/nm-initrd-generator.c @@ -103,50 +103,50 @@ main(int argc, char *argv[]) gboolean dump_to_stdout = FALSE; gs_strfreev char **remaining = NULL; GOptionEntry option_entries[] = { - {"connections-dir", + {"connections-dir", 'c', 0, G_OPTION_ARG_FILENAME, &connections_dir, "Output connection directory", NM_KEYFILE_PATH_NAME_RUN}, - {"persistent-connections-dir", + {"persistent-connections-dir", 'p', 0, G_OPTION_ARG_FILENAME, &etc_connections_dir, "Persistent connection directory", NM_KEYFILE_PATH_NAME_ETC_DEFAULT}, - {"initrd-data-dir", + {"initrd-data-dir", 'i', 0, G_OPTION_ARG_FILENAME, &initrd_dir, "Output initrd data directory", DEFAULT_INITRD_DATA_DIR}, - {"sysfs-dir", + {"sysfs-dir", 'd', 0, G_OPTION_ARG_FILENAME, &sysfs_dir, "The sysfs mount point", DEFAULT_SYSFS_DIR}, - {"run-config-dir", + {"run-config-dir", 'r', 0, G_OPTION_ARG_FILENAME, &run_config_dir, "Output config directory", DEFAULT_RUN_CONFIG_DIR}, - {"stdout", + {"stdout", 's', 0, G_OPTION_ARG_NONE, &dump_to_stdout, "Dump connections to standard output", NULL}, - {G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &remaining, NULL, NULL}, - {NULL}}; + {G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &remaining, NULL, NULL}, + {NULL}}; nm_auto_free_option_context GOptionContext *option_context = NULL; gs_free_error GError *error = NULL; gs_free char *hostname = NULL; diff --git a/src/nm-initrd-generator/nmi-cmdline-reader.c b/src/nm-initrd-generator/nmi-cmdline-reader.c index 431537cf52..bafad04182 100644 --- a/src/nm-initrd-generator/nmi-cmdline-reader.c +++ b/src/nm-initrd-generator/nmi-cmdline-reader.c @@ -539,8 +539,8 @@ reader_parse_ip(Reader *reader, const char *sysfs_dir, char *argument) int client_ip_prefix = -1; gboolean clear_ip4_required_timeout = TRUE; const char *dns[2] = { - NULL, - NULL, + NULL, + NULL, }; int dns_addr_family[2] = { AF_UNSPEC, diff --git a/src/nm-online/nm-online.c b/src/nm-online/nm-online.c index 0807270e61..bba3cd5cc6 100644 --- a/src/nm-online/nm-online.c +++ b/src/nm-online/nm-online.c @@ -233,15 +233,15 @@ main(int argc, char *argv[]) GOptionContext *opt_ctx = NULL; gboolean success; GOptionEntry options[] = { - {"quiet", 'q', 0, G_OPTION_ARG_NONE, &data.quiet, N_("Don't print anything"), NULL}, - {"wait-for-startup", + {"quiet", 'q', 0, G_OPTION_ARG_NONE, &data.quiet, N_("Don't print anything"), NULL}, + {"wait-for-startup", 's', 0, G_OPTION_ARG_NONE, &data.wait_startup, N_("Wait for NetworkManager startup instead of a connection"), NULL}, - {"timeout", + {"timeout", 't', 0, G_OPTION_ARG_INT, @@ -249,14 +249,14 @@ main(int argc, char *argv[]) N_("Time to wait for a connection, in seconds (without the option, default value is 30). " "Maximum value is 2073600 seconds."), ""}, - {"exit", + {"exit", 'x', 0, G_OPTION_ARG_NONE, &data.exit_no_nm, N_("Exit immediately if NetworkManager is not running or connecting"), NULL}, - {NULL}, + {NULL}, }; /* Set locale to be able to use environment variables */ diff --git a/src/nmcli/common.c b/src/nmcli/common.c index ad67a81043..9fdc412720 100644 --- a/src/nmcli/common.c +++ b/src/nmcli/common.c @@ -1035,7 +1035,7 @@ nmc_readline_echo(const NmcConfig *nmc_config, gboolean echo_on, const char *pro #if HAVE_READLINE_HISTORY nm_auto_free HISTORY_STATE *saved_history = NULL; HISTORY_STATE passwd_history = { - 0, + 0, }; #else int start, curpos; diff --git a/src/nmtui/nmt-password-fields.c b/src/nmtui/nmt-password-fields.c index 2aad77ecf6..9d8ea66b19 100644 --- a/src/nmtui/nmt-password-fields.c +++ b/src/nmtui/nmt-password-fields.c @@ -133,10 +133,10 @@ nmt_password_fields_init(NmtPasswordFields *fields) { NmtPasswordFieldsPrivate *priv = NMT_PASSWORD_FIELDS_GET_PRIVATE(fields); NmtNewtPopupEntry entries[] = { - {_("Store password for all users"), NULL}, - {_("Store password only for this user"), NULL}, - {_("Ask password every time"), NULL}, - {}, + {_("Store password for all users"), NULL}, + {_("Store password only for this user"), NULL}, + {_("Ask password every time"), NULL}, + {}, }; priv->entry = NMT_NEWT_ENTRY(nmt_newt_entry_new(-1, 0));