summaryrefslogtreecommitdiff
path: root/libnm-util
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-util
parentf0c1efbf426260c6ed45f3ae83b9a4e2b5a347c4 (diff)
downloadNetworkManager-e69d386975be997d3d840de9045e51521ac4474c.tar.gz
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-util')
-rw-r--r--libnm-util/nm-connection.c2
-rw-r--r--libnm-util/nm-setting-adsl.c2
-rw-r--r--libnm-util/nm-utils.c4
-rw-r--r--libnm-util/nm-value-transforms.c2
4 files changed, 5 insertions, 5 deletions
diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c
index 726cebdca6..3ddea2d742 100644
--- a/libnm-util/nm-connection.c
+++ b/libnm-util/nm-connection.c
@@ -1020,7 +1020,7 @@ nm_connection_update_secrets (NMConnection *connection,
g_signal_handlers_block_by_func (setting, (GCallback) setting_changed_cb, connection);
success_detail = _nm_setting_update_secrets (setting,
- setting_hash ? setting_hash : secrets,
+ setting_hash ?: secrets,
error);
g_signal_handlers_unblock_by_func (setting, (GCallback) setting_changed_cb, connection);
diff --git a/libnm-util/nm-setting-adsl.c b/libnm-util/nm-setting-adsl.c
index 5c1775709a..f2305b38df 100644
--- a/libnm-util/nm-setting-adsl.c
+++ b/libnm-util/nm-setting-adsl.c
@@ -226,7 +226,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
NM_SETTING_ADSL_ERROR,
NM_SETTING_ADSL_ERROR_INVALID_PROPERTY,
_("'%s' is not a valid value for the property"),
- priv->protocol ? priv->protocol : "(null)");
+ priv->protocol ?: "(null)");
g_prefix_error (error, "%s.%s: ", NM_SETTING_ADSL_SETTING_NAME, NM_SETTING_ADSL_PROTOCOL);
return FALSE;
}
diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c
index 5840491026..54e0cc9a82 100644
--- a/libnm-util/nm-utils.c
+++ b/libnm-util/nm-utils.c
@@ -2474,7 +2474,7 @@ static char _nm_utils_inet_ntop_buffer[NM_UTILS_INET_ADDRSTRLEN];
const char *
nm_utils_inet4_ntop (in_addr_t inaddr, char *dst)
{
- return inet_ntop (AF_INET, &inaddr, dst ? dst : _nm_utils_inet_ntop_buffer,
+ return inet_ntop (AF_INET, &inaddr, dst ?: _nm_utils_inet_ntop_buffer,
INET_ADDRSTRLEN);
}
@@ -2502,7 +2502,7 @@ const char *
nm_utils_inet6_ntop (const struct in6_addr *in6addr, char *dst)
{
g_return_val_if_fail (in6addr, NULL);
- return inet_ntop (AF_INET6, in6addr, dst ? dst : _nm_utils_inet_ntop_buffer,
+ return inet_ntop (AF_INET6, in6addr, dst ?: _nm_utils_inet_ntop_buffer,
INET6_ADDRSTRLEN);
}
diff --git a/libnm-util/nm-value-transforms.c b/libnm-util/nm-value-transforms.c
index 2d31f12967..13f9eb43bc 100644
--- a/libnm-util/nm-value-transforms.c
+++ b/libnm-util/nm-value-transforms.c
@@ -104,7 +104,7 @@ _nm_utils_convert_string_list_to_string (const GValue *src_value, GValue *dest_v
for (iter = strings; iter; iter = iter->next) {
if (iter != strings)
g_string_append_c (printable, ',');
- g_string_append (printable, iter->data ? iter->data : "(null)");
+ g_string_append (printable, iter->data ?: "(null)");
}
g_value_take_string (dest_value, g_string_free (printable, FALSE));