format: reformat source tree with clang-format 13.0

We use clang-format for automatic formatting of our source files.
Since clang-format is actively maintained software, the actual
formatting depends on the used version of clang-format. That is
unfortunate and painful, but really unavoidable unless clang-format
would be strictly bug-compatible.

So the version that we must use is from the current Fedora release, which
is also tested by our gitlab-ci. Previously, we were using Fedora 34 with
clang-tools-extra-12.0.1-1.fc34.x86_64.

As Fedora 35 comes along, we need to update our formatting as Fedora 35
comes with version "13.0.0~rc1-1.fc35".
An alternative would be to freeze on version 12, but that has different
problems (like, it's cumbersome to rebuild clang 12 on Fedora 35 and it
would be cumbersome for our developers which are on Fedora 35 to use a
clang that they cannot easily install).

The (differently painful) solution is to reformat from time to time, as we
switch to a new Fedora (and thus clang) version.
Usually we would expect that such a reformatting brings minor changes.
But this time, the changes are huge. That is mentioned in the release
notes [1] as

  Makes PointerAligment: Right working with AlignConsecutiveDeclarations. (Fixes https://llvm.org/PR27353)

[1] https://releases.llvm.org/13.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
This commit is contained in:
Thomas Haller
2021-11-09 13:28:54 +01:00
committed by Beniamino Galvani
parent e44cdc7981
commit 615221a99c
633 changed files with 21047 additions and 20964 deletions

View File

@@ -27,7 +27,7 @@ char *
nm_utils_uuid_generate(void)
{
uuid_t uuid;
char * buf;
char *buf;
buf = g_malloc0(37);
uuid_generate_random(uuid);
@@ -40,10 +40,10 @@ add_connection(GDBusProxy *proxy, const char *con_name)
{
GVariantBuilder connection_builder;
GVariantBuilder setting_builder;
char * uuid;
const char * new_con_path;
GVariant * ret;
GError * error = NULL;
char *uuid;
const char *new_con_path;
GVariant *ret;
GError *error = NULL;
/* Initialize connection GVariantBuilder */
g_variant_builder_init(&connection_builder, G_VARIANT_TYPE("a{sa{sv}}"));
@@ -117,7 +117,7 @@ int
main(int argc, char *argv[])
{
GDBusProxy *proxy;
GError * error = NULL;
GError *error = NULL;
/* Create a D-Bus proxy; NM_DBUS_* defined in nm-dbus-interface.h */
proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,

View File

@@ -19,9 +19,9 @@
static void
added_cb(GObject *client, GAsyncResult *result, gpointer user_data)
{
GMainLoop * loop = user_data;
GMainLoop *loop = user_data;
NMRemoteConnection *remote;
GError * error = NULL;
GError *error = NULL;
/* NM responded to our request; either handle the resulting error or
* print out the object path of the connection we just added.
@@ -43,11 +43,11 @@ added_cb(GObject *client, GAsyncResult *result, gpointer user_data)
static void
add_connection(NMClient *client, GMainLoop *loop, const char *con_name)
{
NMConnection * connection;
NMConnection *connection;
NMSettingConnection *s_con;
NMSettingWired * s_wired;
NMSettingIP4Config * s_ip4;
char * uuid;
NMSettingWired *s_wired;
NMSettingIP4Config *s_ip4;
char *uuid;
/* Create a new connection object */
connection = nm_simple_connection_new();
@@ -88,9 +88,9 @@ add_connection(NMClient *client, GMainLoop *loop, const char *con_name)
int
main(int argc, char *argv[])
{
NMClient * client;
NMClient *client;
GMainLoop *loop;
GError * error = NULL;
GError *error = NULL;
loop = g_main_loop_new(NULL, FALSE);

View File

@@ -25,9 +25,9 @@ static void
print_setting(const char *setting_name, GVariant *setting)
{
GVariantIter iter;
const char * property_name;
GVariant * value;
char * printed_value;
const char *property_name;
GVariant *value;
char *printed_value;
g_print(" %s:\n", setting_name);
g_variant_iter_init(&iter, setting);
@@ -43,14 +43,14 @@ print_setting(const char *setting_name, GVariant *setting)
static void
print_connection(const char *path)
{
GDBusProxy * proxy;
GError * error = NULL;
GVariant * ret, *connection = NULL, *s_con = NULL;
const char * id, *type;
GDBusProxy *proxy;
GError *error = NULL;
GVariant *ret, *connection = NULL, *s_con = NULL;
const char *id, *type;
gboolean found;
GVariantIter iter;
const char * setting_name;
GVariant * setting;
const char *setting_name;
GVariant *setting;
/* This function asks NetworkManager for the details of the connection */
@@ -125,9 +125,9 @@ static void
get_active_connection_details(const char *obj_path)
{
GDBusProxy *props_proxy;
GVariant * ret = NULL, *path_value = NULL;
GVariant *ret = NULL, *path_value = NULL;
const char *path = NULL;
GError * error = NULL;
GError *error = NULL;
/* This function gets the backing Connection object that describes the
* network configuration that the ActiveConnection object is actually using.
@@ -185,9 +185,9 @@ out:
static void
get_active_connections(GDBusProxy *proxy)
{
GError * error = NULL;
GError *error = NULL;
GVariant *ret = NULL, *value = NULL;
char ** paths;
char **paths;
int i;
/* Get the ActiveConnections property from the NM Manager object */

View File

@@ -65,11 +65,11 @@ show_access_point_info(NMAccessPoint *ap)
{
guint32 flags, wpa_flags, rsn_flags, freq, bitrate;
guint8 strength;
GBytes * ssid;
GBytes *ssid;
const char *hwaddr;
NM80211Mode mode;
char * freq_str, *ssid_str, *bitrate_str, *strength_str, *wpa_flags_str, *rsn_flags_str;
GString * security_str;
char *freq_str, *ssid_str, *bitrate_str, *strength_str, *wpa_flags_str, *rsn_flags_str;
GString *security_str;
/* Get AP properties */
flags = nm_access_point_get_flags(ap);
@@ -138,13 +138,13 @@ show_access_point_info(NMAccessPoint *ap)
static void
show_wifi_device_info(NMDevice *device)
{
NMAccessPoint * active_ap = NULL;
NMAccessPoint *active_ap = NULL;
const GPtrArray *aps;
const char * iface;
const char * driver;
const char *iface;
const char *driver;
guint32 speed;
GBytes * active_ssid;
char * active_ssid_str = NULL;
GBytes *active_ssid;
char *active_ssid_str = NULL;
int i;
/* Get active AP */
@@ -185,10 +185,10 @@ show_wifi_device_info(NMDevice *device)
int
main(int argc, char *argv[])
{
NMClient * client;
NMClient *client;
const GPtrArray *devices;
int i;
GError * error = NULL;
GError *error = NULL;
/* Get NMClient object */
client = nm_client_new(NULL, &error);

View File

@@ -21,9 +21,9 @@ static void
list_connections(GDBusProxy *proxy)
{
int i;
GError * error = NULL;
GError *error = NULL;
GVariant *ret;
char ** paths;
char **paths;
/* Call ListConnections D-Bus method */
ret = g_dbus_proxy_call_sync(proxy,

View File

@@ -24,9 +24,9 @@ show_connection(NMConnection *connection)
{
NMSettingConnection *s_con;
guint64 timestamp;
char * timestamp_str;
char *timestamp_str;
char timestamp_real_str[64];
const char * val1, *val2, *val3, *val4, *val5;
const char *val1, *val2, *val3, *val4, *val5;
s_con = nm_connection_get_setting_connection(connection);
if (s_con) {
@@ -55,8 +55,8 @@ show_connection(NMConnection *connection)
int
main(int argc, char *argv[])
{
NMClient * client;
GError * error = NULL;
NMClient *client;
GError *error = NULL;
const GPtrArray *connections;
int i;

View File

@@ -18,8 +18,8 @@
static void
on_name_appeared(GDBusConnection *connection,
const char * name,
const char * name_owner,
const char *name,
const char *name_owner,
gpointer user_data)
{
g_print("Name '%s' on the system bus is owned by %s => NM is running\n", name, name_owner);
@@ -35,7 +35,7 @@ int
main(int argc, char *argv[])
{
guint watcher_id;
GMainLoop * loop;
GMainLoop *loop;
GBusNameWatcherFlags flags;
g_print("Monitor 'org.freedesktop.NetworkManager' D-Bus name\n");

View File

@@ -45,9 +45,9 @@ nm_state_to_string(NMState state)
static void
on_signal(GDBusProxy *proxy,
char * sender_name,
char * signal_name,
GVariant * parameters,
char *sender_name,
char *signal_name,
GVariant *parameters,
gpointer user_data)
{
guint32 new_state;
@@ -72,10 +72,10 @@ on_signal(GDBusProxy *proxy,
int
main(int argc, char *argv[])
{
GMainLoop * loop;
GError * error = NULL;
GMainLoop *loop;
GError *error = NULL;
GDBusProxyFlags flags;
GDBusProxy * proxy;
GDBusProxy *proxy;
/* Monitor 'StateChanged' signal on 'org.freedesktop.NetworkManager' interface */
g_print("Monitor NetworkManager's state\n");

View File

@@ -17,18 +17,18 @@ static NMConnection *
vpn_connection_import(const char *filename)
{
NMConnection *conn = NULL;
GSList * plugins;
GSList * iter;
GSList *plugins;
GSList *iter;
g_print("Try to import file \"%s\"...\n", filename);
plugins = nm_vpn_plugin_info_list_load();
for (iter = plugins; iter; iter = iter->next) {
GError * error = NULL;
NMVpnPluginInfo * plugin = iter->data;
GError *error = NULL;
NMVpnPluginInfo *plugin = iter->data;
NMVpnEditorPlugin *editor;
const char * plugin_name = nm_vpn_plugin_info_get_name(plugin);
const char *plugin_name = nm_vpn_plugin_info_get_name(plugin);
g_print("plugin[%s]: trying import...\n", plugin_name);
@@ -72,8 +72,8 @@ vpn_connection_import(const char *filename)
/*****************************************************************************/
typedef struct {
GMainLoop * loop;
GError * error;
GMainLoop *loop;
GError *error;
NMRemoteConnection *rconn;
} RequestData;
@@ -89,8 +89,8 @@ add_cb(GObject *source, GAsyncResult *result, gpointer user_data)
static NMRemoteConnection *
connection_add(NMConnection *conn)
{
GError * error = NULL;
NMClient * client;
GError *error = NULL;
NMClient *client;
RequestData rdata;
g_print("Adding connection \"%s\" (%s)\n",
@@ -137,8 +137,8 @@ int
main(int argc, char **argv)
{
NMRemoteConnection *rconn;
NMConnection * conn;
const char * filename;
NMConnection *conn;
const char *filename;
gboolean success;
if (argc < 2) {