summaryrefslogtreecommitdiff
path: root/libnm-glib
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-04-24 11:20:03 +0200
committerLubomir Rintel <lkundrak@v3.sk>2018-05-10 14:36:58 +0200
commite69d386975be997d3d840de9045e51521ac4474c (patch)
treec240198404e8bdc5396c3e9608d0cc387337abfc /libnm-glib
parentf0c1efbf426260c6ed45f3ae83b9a4e2b5a347c4 (diff)
all: use the elvis operator wherever possible
Coccinelle: @@ expression a, b; @@ -a ? a : b +a ?: b Applied with: spatch --sp-file ternary.cocci --in-place --smpl-spacing --dir . With some manual adjustments on spots that Cocci didn't catch for reasons unknown. Thanks to the marvelous effort of the GNU compiler developer we can now spare a couple of bits that could be used for more important things, like this commit message. Standards commitees yet have to catch up.
Diffstat (limited to 'libnm-glib')
-rw-r--r--libnm-glib/nm-client.c8
-rw-r--r--libnm-glib/nm-object.c4
-rw-r--r--libnm-glib/nm-remote-settings.c4
3 files changed, 8 insertions, 8 deletions
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c
index c14d8c969..0da7b0f4e 100644
--- a/libnm-glib/nm-client.c
+++ b/libnm-glib/nm-client.c
@@ -674,7 +674,7 @@ nm_client_activate_connection (NMClient *client,
activate_cb, info, NULL,
DBUS_TYPE_G_OBJECT_PATH, connection ? nm_connection_get_path (connection) : "/",
DBUS_TYPE_G_OBJECT_PATH, device ? nm_object_get_path (NM_OBJECT (device)) : "/",
- DBUS_TYPE_G_OBJECT_PATH, specific_object ? specific_object : "/",
+ DBUS_TYPE_G_OBJECT_PATH, specific_object ?: "/",
G_TYPE_INVALID);
}
@@ -762,7 +762,7 @@ nm_client_add_and_activate_connection (NMClient *client,
add_activate_cb, info, NULL,
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, hash,
DBUS_TYPE_G_OBJECT_PATH, nm_object_get_path (NM_OBJECT (device)),
- DBUS_TYPE_G_OBJECT_PATH, specific_object ? specific_object : "/",
+ DBUS_TYPE_G_OBJECT_PATH, specific_object ?: "/",
G_TYPE_INVALID);
} else
info->idle_id = g_idle_add (activate_nm_not_running, info);
@@ -1257,8 +1257,8 @@ nm_client_set_logging (NMClient *client, const char *level, const char *domains,
return TRUE;
return dbus_g_proxy_call (priv->client_proxy, "SetLogging", error,
- G_TYPE_STRING, level ? level : "",
- G_TYPE_STRING, domains ? domains : "",
+ G_TYPE_STRING, level ?: "",
+ G_TYPE_STRING, domains ?: "",
G_TYPE_INVALID,
G_TYPE_INVALID);
}
diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c
index 56db7e3cd..5956b344e 100644
--- a/libnm-glib/nm-object.c
+++ b/libnm-glib/nm-object.c
@@ -1328,7 +1328,7 @@ _nm_object_register_properties (NMObject *object,
}
pi = g_malloc0 (sizeof (PropertyInfo));
- pi->func = tmp->func ? tmp->func : demarshal_generic;
+ pi->func = tmp->func ?: demarshal_generic;
pi->object_type = tmp->object_type;
pi->field = tmp->field;
pi->signal_prefix = tmp->signal_prefix;
@@ -1572,5 +1572,5 @@ _nm_object_new_proxy (NMObject *self, const char *path, const char *interface)
{
NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (self);
- return _nm_dbus_new_proxy_for_connection (priv->connection, path ? path : priv->path, interface);
+ return _nm_dbus_new_proxy_for_connection (priv->connection, path ?: priv->path, interface);
}
diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c
index be6b7ee3b..e8a80f6fd 100644
--- a/libnm-glib/nm-remote-settings.c
+++ b/libnm-glib/nm-remote-settings.c
@@ -576,7 +576,7 @@ fetch_connections_done (DBusGProxy *proxy,
&& priv->service_running) {
g_warning ("%s: error fetching connections: %s.",
__func__,
- error->message ? error->message : "(unknown)");
+ error->message ?: "(unknown)");
}
g_clear_error (&error);
@@ -964,7 +964,7 @@ nm_remote_settings_save_hostname (NMRemoteSettings *settings,
save_hostname_cb,
info,
g_free,
- G_TYPE_STRING, hostname ? hostname : "",
+ G_TYPE_STRING, hostname ?: "",
G_TYPE_INVALID);
return TRUE;
}