summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/devices/adsl/nm-atm-manager.c2
-rw-r--r--src/devices/adsl/nm-device-adsl.c2
-rw-r--r--src/devices/bluetooth/nm-bluez-device.c2
-rw-r--r--src/devices/nm-device-bond.c4
-rw-r--r--src/devices/nm-device.c2
-rw-r--r--src/devices/ovs/nm-ovsdb.c20
-rw-r--r--src/devices/wifi/nm-device-wifi.c4
-rw-r--r--src/devices/wwan/nm-modem-broadband.c2
-rw-r--r--src/devices/wwan/nm-modem.c2
-rw-r--r--src/dhcp/nm-dhcp-client.c2
-rw-r--r--src/dhcp/nm-dhcp-listener.c2
-rw-r--r--src/dhcp/nm-dhcp-manager.c2
-rw-r--r--src/main.c2
-rw-r--r--src/nm-config.c4
-rw-r--r--src/nm-core-utils.c10
-rw-r--r--src/nm-core-utils.h2
-rw-r--r--src/nm-dispatcher.c6
-rw-r--r--src/nm-firewall-manager.c2
-rw-r--r--src/nm-manager.c2
-rw-r--r--src/nm-policy.c2
-rw-r--r--src/nm-rfkill-manager.c2
-rw-r--r--src/platform/nm-linux-platform.c2
-rw-r--r--src/platform/nm-platform.c12
-rw-r--r--src/platform/tests/test-common.c6
-rw-r--r--src/settings/nm-settings-connection.c8
-rw-r--r--src/settings/plugins/ibft/nms-ibft-reader.c8
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c10
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c2
-rw-r--r--src/settings/plugins/ifupdown/nms-ifupdown-parser.c4
-rw-r--r--src/supplicant/nm-supplicant-config.c10
-rw-r--r--src/supplicant/nm-supplicant-settings-verify.c4
-rw-r--r--src/vpn/nm-vpn-connection.c6
33 files changed, 76 insertions, 76 deletions
diff --git a/src/devices/adsl/nm-atm-manager.c b/src/devices/adsl/nm-atm-manager.c
index 32c4c386dc..0ff4603df5 100644
--- a/src/devices/adsl/nm-atm-manager.c
+++ b/src/devices/adsl/nm-atm-manager.c
@@ -236,7 +236,7 @@ handle_uevent (NMUdevClient *client,
ifindex = udev_device_get_property_value (device, "IFINDEX");
seqnum = udev_device_get_seqnum (device);
nm_log_dbg (LOGD_PLATFORM, "UDEV event: action '%s' subsys '%s' device '%s' (%s); seqnum=%" G_GUINT64_FORMAT,
- action, subsys, udev_device_get_sysname (device), ifindex ? ifindex : "unknown", seqnum);
+ action, subsys, udev_device_get_sysname (device), ifindex ?: "unknown", seqnum);
if (!strcmp (action, "add"))
adsl_add (self, device);
diff --git a/src/devices/adsl/nm-device-adsl.c b/src/devices/adsl/nm-device-adsl.c
index 9133137682..5fcc823a20 100644
--- a/src/devices/adsl/nm-device-adsl.c
+++ b/src/devices/adsl/nm-device-adsl.c
@@ -194,7 +194,7 @@ br2684_assign_vcc (NMDeviceAdsl *self, NMSettingAdsl *s_adsl)
_LOGD (LOGD_ADSL, "assigning address %d.%d.%d encapsulation %s",
priv->atm_index, addr.sap_addr.vpi, addr.sap_addr.vci,
- encapsulation ? encapsulation : "(none)");
+ encapsulation ?: "(none)");
err = connect (priv->brfd, (struct sockaddr*) &addr, sizeof (addr));
if (err != 0) {
diff --git a/src/devices/bluetooth/nm-bluez-device.c b/src/devices/bluetooth/nm-bluez-device.c
index cc9e38c89b..d8e40d6f38 100644
--- a/src/devices/bluetooth/nm-bluez-device.c
+++ b/src/devices/bluetooth/nm-bluez-device.c
@@ -494,7 +494,7 @@ nm_bluez_device_disconnect (NMBluezDevice *self)
priv->path,
dbus_iface,
"Disconnect",
- args ? args : g_variant_new ("()"),
+ args ?: g_variant_new("()"),
NULL,
G_DBUS_CALL_FLAGS_NONE,
10000,
diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c
index 2dd9494a8b..22f7cdde35 100644
--- a/src/devices/nm-device-bond.c
+++ b/src/devices/nm-device-bond.c
@@ -314,7 +314,7 @@ apply_bonding_config (NMDevice *device)
/* Primary */
value = nm_setting_bond_get_option_by_name (s_bond, NM_SETTING_BOND_OPTION_PRIMARY);
- set_bond_attr (device, mode, NM_SETTING_BOND_OPTION_PRIMARY, value ? value : "");
+ set_bond_attr (device, mode, NM_SETTING_BOND_OPTION_PRIMARY, value ?: "");
/* ARP targets: clear and initialize the list */
contents = nm_platform_sysctl_master_get_option (nm_device_get_platform (device), ifindex,
@@ -591,7 +591,7 @@ reapply_connection (NMDevice *device, NMConnection *con_old, NMConnection *con_n
/* Primary */
value = nm_setting_bond_get_option_by_name (s_bond, NM_SETTING_BOND_OPTION_PRIMARY);
- set_bond_attr (device, mode, NM_SETTING_BOND_OPTION_PRIMARY, value ? value : "");
+ set_bond_attr (device, mode, NM_SETTING_BOND_OPTION_PRIMARY, value ?: "");
/* Active slave */
set_simple_option (device, mode, s_bond, NM_SETTING_BOND_OPTION_ACTIVE_SLAVE);
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index ed63adf548..3980758631 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -1357,7 +1357,7 @@ nm_device_get_ip_iface (NMDevice *self)
priv = NM_DEVICE_GET_PRIVATE (self);
/* If it's not set, default to iface */
- return priv->ip_iface ? priv->ip_iface : priv->iface;
+ return priv->ip_iface ?: priv->iface;
}
int
diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c
index 12e7c1f15e..a9cb57034a 100644
--- a/src/devices/ovs/nm-ovsdb.c
+++ b/src/devices/ovs/nm-ovsdb.c
@@ -363,7 +363,7 @@ _insert_interface (json_t *params, NMConnection *interface)
json_pack ("{s:s, s:s, s:{s:s, s:s, s:o, s:[s, [[s, s]]]}, s:s}",
"op", "insert", "table", "Interface", "row",
"name", nm_connection_get_interface_name (interface),
- "type", type ? type : "",
+ "type", type ?: "",
"options", options,
"external_ids", "map", "NM.connection.uuid", nm_connection_get_uuid (interface),
"uuid-name", "rowInterface"));
@@ -891,7 +891,7 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg)
_LOGT ("removed an '%s' interface: %s%s%s",
ovs_interface->type, ovs_interface->name,
ovs_interface->connection_uuid ? ", " : "",
- ovs_interface->connection_uuid ? ovs_interface->connection_uuid : "");
+ ovs_interface->connection_uuid ?: "");
if (g_strcmp0 (ovs_interface->type, "internal") == 0) {
/* Currently the factory only creates NMDevices for
* internal interfaces. Ignore the rest. */
@@ -910,14 +910,14 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg)
if (old) {
_LOGT ("changed an '%s' interface: %s%s%s", type, ovs_interface->name,
ovs_interface->connection_uuid ? ", " : "",
- ovs_interface->connection_uuid ? ovs_interface->connection_uuid : "");
+ ovs_interface->connection_uuid ?: "");
g_signal_emit (self, signals[DEVICE_CHANGED], 0,
"ovs-interface", ovs_interface->name);
} else {
_LOGT ("added an '%s' interface: %s%s%s",
ovs_interface->type, ovs_interface->name,
ovs_interface->connection_uuid ? ", " : "",
- ovs_interface->connection_uuid ? ovs_interface->connection_uuid : "");
+ ovs_interface->connection_uuid ?: "");
if (g_strcmp0 (ovs_interface->type, "internal") == 0) {
/* Currently the factory only creates NMDevices for
* internal interfaces. Ignore the rest. */
@@ -949,7 +949,7 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg)
old = FALSE;
_LOGT ("removed a port: %s%s%s", ovs_port->name,
ovs_port->connection_uuid ? ", " : "",
- ovs_port->connection_uuid ? ovs_port->connection_uuid : "");
+ ovs_port->connection_uuid ?: "");
g_signal_emit (self, signals[DEVICE_REMOVED], 0,
ovs_port->name, NM_DEVICE_TYPE_OVS_PORT);
}
@@ -965,13 +965,13 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg)
if (old) {
_LOGT ("changed a port: %s%s%s", ovs_port->name,
ovs_port->connection_uuid ? ", " : "",
- ovs_port->connection_uuid ? ovs_port->connection_uuid : "");
+ ovs_port->connection_uuid ?: "");
g_signal_emit (self, signals[DEVICE_CHANGED], 0,
NM_SETTING_OVS_PORT_SETTING_NAME, ovs_port->name);
} else {
_LOGT ("added a port: %s%s%s", ovs_port->name,
ovs_port->connection_uuid ? ", " : "",
- ovs_port->connection_uuid ? ovs_port->connection_uuid : "");
+ ovs_port->connection_uuid ?: "");
g_signal_emit (self, signals[DEVICE_ADDED], 0,
ovs_port->name, NM_DEVICE_TYPE_OVS_PORT);
}
@@ -999,7 +999,7 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg)
old = FALSE;
_LOGT ("removed a bridge: %s%s%s", ovs_bridge->name,
ovs_bridge->connection_uuid ? ", " : "",
- ovs_bridge->connection_uuid ? ovs_bridge->connection_uuid : "");
+ ovs_bridge->connection_uuid ?: "");
g_signal_emit (self, signals[DEVICE_REMOVED], 0,
ovs_bridge->name, NM_DEVICE_TYPE_OVS_BRIDGE);
}
@@ -1015,13 +1015,13 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg)
if (old) {
_LOGT ("changed a bridge: %s%s%s", ovs_bridge->name,
ovs_bridge->connection_uuid ? ", " : "",
- ovs_bridge->connection_uuid ? ovs_bridge->connection_uuid : "");
+ ovs_bridge->connection_uuid ?: "");
g_signal_emit (self, signals[DEVICE_CHANGED], 0,
NM_SETTING_OVS_BRIDGE_SETTING_NAME, ovs_bridge->name);
} else {
_LOGT ("added a bridge: %s%s%s", ovs_bridge->name,
ovs_bridge->connection_uuid ? ", " : "",
- ovs_bridge->connection_uuid ? ovs_bridge->connection_uuid : "");
+ ovs_bridge->connection_uuid ?: "");
g_signal_emit (self, signals[DEVICE_ADDED], 0,
ovs_bridge->name, NM_DEVICE_TYPE_OVS_BRIDGE);
}
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index 1590f16625..90f9455742 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -2147,9 +2147,9 @@ supplicant_iface_notify_current_bss (NMSupplicantInterface *iface,
}
_LOGD (LOGD_WIFI, "roamed from BSSID %s (%s) to %s (%s)",
- old_bssid ? old_bssid : "(none)",
+ old_bssid ?: "(none)",
old_ssid ? nm_utils_escape_ssid (old_ssid->data, old_ssid->len) : "(none)",
- new_bssid ? new_bssid : "(none)",
+ new_bssid ?: "(none)",
new_ssid ? nm_utils_escape_ssid (new_ssid->data, new_ssid->len) : "(none)");
set_current_ap (self, new_ap, TRUE);
diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
index a58eb78758..e5678b9635 100644
--- a/src/devices/wwan/nm-modem-broadband.c
+++ b/src/devices/wwan/nm-modem-broadband.c
@@ -286,7 +286,7 @@ create_gsm_connect_properties (NMConnection *connection)
/* Blank APN ("") means the default subscription APN */
str = nm_setting_gsm_get_apn (setting);
- mm_simple_connect_properties_set_apn (properties, str ? str : "");
+ mm_simple_connect_properties_set_apn (properties, str ?: "");
str = nm_setting_gsm_get_network_id (setting);
if (str)
diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c
index 61b7247ec8..80336d7209 100644
--- a/src/devices/wwan/nm-modem.c
+++ b/src/devices/wwan/nm-modem.c
@@ -205,7 +205,7 @@ nm_modem_set_state (NMModem *self,
_LOGI ("modem state changed, '%s' --> '%s' (reason: %s)",
nm_modem_state_to_string (old_state),
nm_modem_state_to_string (new_state),
- reason ? reason : "none");
+ reason ?: "none");
priv->state = new_state;
_notify (self, PROP_STATE);
diff --git a/src/dhcp/nm-dhcp-client.c b/src/dhcp/nm-dhcp-client.c
index 96c0265388..f407da89ae 100644
--- a/src/dhcp/nm-dhcp-client.c
+++ b/src/dhcp/nm-dhcp-client.c
@@ -334,7 +334,7 @@ nm_dhcp_client_stop_pid (pid_t pid, const char *iface)
g_return_if_fail (pid > 1);
- nm_utils_kill_child_sync (pid, SIGTERM, LOGD_DHCP, name ? name : "dhcp-client", NULL,
+ nm_utils_kill_child_sync (pid, SIGTERM, LOGD_DHCP, name ?: "dhcp-client", NULL,
1000 / 2, 1000 / 20);
g_free (name);
}
diff --git a/src/dhcp/nm-dhcp-listener.c b/src/dhcp/nm-dhcp-listener.c
index d7d38e5463..1770ead34f 100644
--- a/src/dhcp/nm-dhcp-listener.c
+++ b/src/dhcp/nm-dhcp-listener.c
@@ -160,7 +160,7 @@ _method_call_handle (NMDhcpListener *self,
pid_str = get_option (options, "pid");
pid = _nm_utils_ascii_str_to_int64 (pid_str, 10, 0, G_MAXINT32, -1);
if (pid == -1) {
- _LOGW ("dhcp-event: couldn't convert PID '%s' to an integer", pid_str ? pid_str : "(null)");
+ _LOGW ("dhcp-event: couldn't convert PID '%s' to an integer", pid_str ?: "(null)");
return;
}
diff --git a/src/dhcp/nm-dhcp-manager.c b/src/dhcp/nm-dhcp-manager.c
index bf22872d4e..aa40e8037d 100644
--- a/src/dhcp/nm-dhcp-manager.c
+++ b/src/dhcp/nm-dhcp-manager.c
@@ -311,7 +311,7 @@ nm_dhcp_manager_start_ip6 (NMDhcpManager *self,
if (send_hostname) {
/* Always prefer the explicit dhcp-hostname if given */
- hostname = dhcp_hostname ? dhcp_hostname : priv->default_hostname;
+ hostname = dhcp_hostname ?: priv->default_hostname;
}
return client_start (self, AF_INET6, multi_idx, iface, ifindex, hwaddr, uuid,
route_table, route_metric, ll_addr,
diff --git a/src/main.c b/src/main.c
index 714d7bcf46..c1267b275d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -214,7 +214,7 @@ do_early_setup (int *argc, char **argv[], NMConfigCmdLineOptions *config_cli)
_("NetworkManager monitors all network connections and automatically\nchooses the best connection to use. It also allows the user to\nspecify wireless access points which wireless cards in the computer\nshould associate with.")))
exit (1);
- global_opt.pidfile = global_opt.pidfile ? global_opt.pidfile : g_strdup (NM_DEFAULT_PID_FILE);
+ global_opt.pidfile = global_opt.pidfile ?: g_strdup(NM_DEFAULT_PID_FILE);
}
/*
diff --git a/src/nm-config.c b/src/nm-config.c
index bef05fc78c..d4682ed6da 100644
--- a/src/nm-config.c
+++ b/src/nm-config.c
@@ -579,7 +579,7 @@ ignore_config_snippet (GKeyFile *keyfile, gboolean is_base_config)
const char *e;
e = g_getenv ("NM_CONFIG_ENABLE_TAG");
- _nm_config_match_env = g_strdup (e ? e : "");
+ _nm_config_match_env = g_strdup (e ?: "");
}
/* second, interpret the value as match-spec. */
@@ -2407,7 +2407,7 @@ _set_config_data (NMConfig *self, NMConfigData *new_data, NMConfigChangeFlags re
else
_LOGI ("signal: %s", nm_config_change_flags_to_string (changes, NULL, 0));
g_signal_emit (self, signals[SIGNAL_CONFIG_CHANGED], 0,
- new_data ? new_data : old_data,
+ new_data ?: old_data,
changes, old_data);
if (new_data)
g_object_unref (old_data);
diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c
index 548101e7b6..0e3f5cc919 100644
--- a/src/nm-core-utils.c
+++ b/src/nm-core-utils.c
@@ -2044,8 +2044,8 @@ _log_connection_sort_hashes_fcn (gconstpointer a, gconstpointer b)
NMSettingPriority p1, p2;
NMSetting *s1, *s2;
- s1 = v1->setting ? v1->setting : v1->diff_base_setting;
- s2 = v2->setting ? v2->setting : v2->diff_base_setting;
+ s1 = v1->setting ?: v1->diff_base_setting;
+ s2 = v2->setting ?: v2->diff_base_setting;
g_assert (s1 && s2);
@@ -2279,13 +2279,13 @@ nm_utils_log_connection_diff (NMConnection *connection,
g_string_printf (str1, "%s.%s", setting_data->name, item->item_name);
switch (item->diff_result & (NM_SETTING_DIFF_RESULT_IN_A | NM_SETTING_DIFF_RESULT_IN_B)) {
case NM_SETTING_DIFF_RESULT_IN_B:
- nm_log (level, domain, NULL, NULL, "%s%"_NM_LOG_ALIGN"s < %s", prefix, str1->str, str_diff ? str_diff : "NULL");
+ nm_log (level, domain, NULL, NULL, "%s%"_NM_LOG_ALIGN"s < %s", prefix, str1->str, str_diff ?: "NULL");
break;
case NM_SETTING_DIFF_RESULT_IN_A:
- nm_log (level, domain, NULL, NULL, "%s%"_NM_LOG_ALIGN"s = %s", prefix, str1->str, str_conn ? str_conn : "NULL");
+ nm_log (level, domain, NULL, NULL, "%s%"_NM_LOG_ALIGN"s = %s", prefix, str1->str, str_conn ?: "NULL");
break;
default:
- nm_log (level, domain, NULL, NULL, "%s%"_NM_LOG_ALIGN"s = %s < %s", prefix, str1->str, str_conn ? str_conn : "NULL", str_diff ? str_diff : "NULL");
+ nm_log (level, domain, NULL, NULL, "%s%"_NM_LOG_ALIGN"s = %s < %s", prefix, str1->str, str_conn ?: "NULL", str_diff ?: "NULL");
break;
#undef _NM_LOG_ALIGN
}
diff --git a/src/nm-core-utils.h b/src/nm-core-utils.h
index 488eb827d2..a9a70038f9 100644
--- a/src/nm-core-utils.h
+++ b/src/nm-core-utils.h
@@ -158,7 +158,7 @@ double nm_utils_exp10 (gint16 e);
static inline guint32
nm_utils_ip6_route_metric_normalize (guint32 metric)
{
- return metric ? metric : 1024 /*NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6*/;
+ return metric ?: 1024 /*NM_PLATFORM_ROUTE_METRIC_DEFAULT_IP6*/;
}
static inline guint32
diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c
index 235134c872..368b781ad1 100644
--- a/src/nm-dispatcher.c
+++ b/src/nm-dispatcher.c
@@ -547,7 +547,7 @@ _dispatcher_call (NMDispatcherAction action,
_LOGD ("(%u) (%s) dispatching action '%s'%s",
reqid,
- vpn_iface ? vpn_iface : nm_device_get_iface (device),
+ vpn_iface ?: nm_device_get_iface(device),
action_to_string (action),
blocking
? " (blocking)"
@@ -650,7 +650,7 @@ _dispatcher_call (NMDispatcherAction action,
device_dhcp4_props,
device_dhcp6_props,
connectivity_state_string,
- vpn_iface ? vpn_iface : "",
+ vpn_iface ?: "",
&vpn_proxy_props,
&vpn_ip4_props,
&vpn_ip6_props,
@@ -688,7 +688,7 @@ _dispatcher_call (NMDispatcherAction action,
device_dhcp4_props,
device_dhcp6_props,
connectivity_state_string,
- vpn_iface ? vpn_iface : "",
+ vpn_iface ?: "",
&vpn_proxy_props,
&vpn_ip4_props,
&vpn_ip6_props,
diff --git a/src/nm-firewall-manager.c b/src/nm-firewall-manager.c
index 134a46f7ec..5b5e7cfa20 100644
--- a/src/nm-firewall-manager.c
+++ b/src/nm-firewall-manager.c
@@ -174,7 +174,7 @@ _cb_info_create (NMFirewallManager *self,
if (priv->running || priv->proxy_cancellable) {
info->mode_mutable = CB_INFO_MODE_DBUS_WAITING;
- info->dbus.arg = g_variant_new ("(ss)", zone ? zone : "", iface);
+ info->dbus.arg = g_variant_new ("(ss)", zone ?: "", iface);
} else
info->mode_mutable = CB_INFO_MODE_IDLE;
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 8c9eb890b9..9f0891a75d 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -6977,7 +6977,7 @@ get_property (GObject *object, guint prop_id,
if (con)
type = nm_connection_get_connection_type (con);
}
- g_value_set_string (value, type ? type : "");
+ g_value_set_string (value, type ?: "");
break;
case PROP_ACTIVATING_CONNECTION:
nm_dbus_utils_g_value_set_object_path (value, priv->activating_connection);
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 55b6caf601..61cc001f0b 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -2119,7 +2119,7 @@ vpn_connection_retry_after_failure (NMVpnConnection *vpn, NMPolicy *self)
&error)) {
_LOGW (LOGD_DEVICE, "VPN '%s' reconnect failed: %s",
nm_settings_connection_get_id (connection),
- error->message ? error->message : "unknown");
+ error->message ?: "unknown");
g_clear_error (&error);
}
}
diff --git a/src/nm-rfkill-manager.c b/src/nm-rfkill-manager.c
index e655e67cc3..b2909e9d3e 100644
--- a/src/nm-rfkill-manager.c
+++ b/src/nm-rfkill-manager.c
@@ -296,7 +296,7 @@ add_one_killswitch (NMRfkillManager *self, struct udev_device *device)
rfkill_type_to_desc (rtype),
ks->path,
ks->platform ? "platform " : "",
- ks->driver ? ks->driver : "<unknown>");
+ ks->driver ?: "<unknown>");
}
static void
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index c6413d9676..3a671acf74 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -6980,7 +6980,7 @@ handle_udev_event (NMUdevClient *udev_client,
seqnum = udev_device_get_seqnum (udevice);
_LOGD ("UDEV event: action '%s' subsys '%s' device '%s' (%s); seqnum=%" G_GUINT64_FORMAT,
action, subsys, udev_device_get_sysname (udevice),
- ifindex ? ifindex : "unknown", seqnum);
+ ifindex ?: "unknown", seqnum);
if (NM_IN_STRSET (action, "add", "move"))
udev_device_added (platform, udevice);
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index c71bda4d03..727e064bd5 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -4882,11 +4882,11 @@ nm_platform_link_to_string (const NMPlatformLink *link, char *buf, gsize len)
link->inet6_addr_gen_mode_inv ? " addrgenmode " : "",
link->inet6_addr_gen_mode_inv ? nm_platform_link_inet6_addrgenmode2str (_nm_platform_uint8_inv (link->inet6_addr_gen_mode_inv), str_addrmode, sizeof (str_addrmode)) : "",
str_addr ? " addr " : "",
- str_addr ? str_addr : "",
+ str_addr ?: "",
link->inet6_token.id ? " inet6token " : "",
link->inet6_token.id ? nm_utils_inet6_interface_identifier_to_token (link->inet6_token, str_inet6_token) : "",
link->driver ? " driver " : "",
- link->driver ? link->driver : "",
+ link->driver ?: "",
link->rx_packets, link->rx_bytes,
link->tx_packets, link->tx_bytes);
g_string_free (str_flags, TRUE);
@@ -5298,7 +5298,7 @@ nm_platform_ip4_address_to_string (const NMPlatformIP4Address *address, char *bu
str_label[0] = 0;
str_lft_p = _lifetime_to_string (address->timestamp,
- address->lifetime ? address->lifetime : NM_PLATFORM_LIFETIME_PERMANENT,
+ address->lifetime ?: NM_PLATFORM_LIFETIME_PERMANENT,
now, str_lft, sizeof (str_lft)),
str_pref_p = (address->lifetime == address->preferred)
? str_lft_p
@@ -5310,7 +5310,7 @@ nm_platform_ip4_address_to_string (const NMPlatformIP4Address *address, char *bu
g_snprintf (buf, len,
"%s/%d lft %s pref %s%s%s%s%s%s src %s",
s_address, address->plen, str_lft_p, str_pref_p, str_time_p,
- str_peer ? str_peer : "",
+ str_peer ?: "",
str_dev,
_to_string_ifa_flags (address->n_ifa_flags, s_flags, sizeof (s_flags)),
str_label,
@@ -5405,7 +5405,7 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address, char *bu
_to_string_dev (NULL, address->ifindex, str_dev, sizeof (str_dev));
str_lft_p = _lifetime_to_string (address->timestamp,
- address->lifetime ? address->lifetime : NM_PLATFORM_LIFETIME_PERMANENT,
+ address->lifetime ?: NM_PLATFORM_LIFETIME_PERMANENT,
now, str_lft, sizeof (str_lft)),
str_pref_p = (address->lifetime == address->preferred)
? str_lft_p
@@ -5417,7 +5417,7 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address, char *bu
g_snprintf (buf, len,
"%s/%d lft %s pref %s%s%s%s%s src %s",
s_address, address->plen, str_lft_p, str_pref_p, str_time_p,
- str_peer ? str_peer : "",
+ str_peer ?: "",
str_dev,
_to_string_ifa_flags (address->n_ifa_flags, s_flags, sizeof (s_flags)),
nmp_utils_ip_config_source_to_string (address->addr_source, s_source, sizeof (s_source)));
diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c
index 7885c083b6..42569d5b17 100644
--- a/src/platform/tests/test-common.c
+++ b/src/platform/tests/test-common.c
@@ -28,7 +28,7 @@
#include "test-common.h"
#define SIGNAL_DATA_FMT "'%s-%s' ifindex %d%s%s%s (%d times received)"
-#define SIGNAL_DATA_ARG(data) (data)->name, nm_platform_signal_change_type_to_string ((data)->change_type), (data)->ifindex, (data)->ifname ? " ifname '" : "", (data)->ifname ? (data)->ifname : "", (data)->ifname ? "'" : "", (data)->received_count
+#define SIGNAL_DATA_ARG(data) (data)->name, nm_platform_signal_change_type_to_string ((data)->change_type), (data)->ifindex, (data)->ifname ? " ifname '" : "", (data)->ifname ?: "", (data)->ifname ? "'" : "", (data)->received_count
int NMTSTP_ENV1_IFINDEX = -1;
int NMTSTP_ENV1_EX = -1;
@@ -1258,7 +1258,7 @@ nmtstp_link_gre_add (NMPlatform *platform,
success = !nmtstp_run_command ("ip tunnel add %s mode gre %s local %s remote %s ttl %u tos %02x %s",
name,
- dev ? dev : "",
+ dev ?: "",
nm_utils_inet4_ntop (lnk->local, NULL),
nm_utils_inet4_ntop (lnk->remote, buffer),
lnk->ttl,
@@ -1568,7 +1568,7 @@ nmtstp_link_vxlan_add (NMPlatform *platform,
err = nmtstp_run_command ("ip link add %s type vxlan id %u %s local %s group %s ttl %u tos %02x dstport %u srcport %u %u ageing %u",
name,
lnk->id,
- dev ? dev : "",
+ dev ?: "",
local,
remote,
lnk->ttl,
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index abc7c524b8..6526abc76f 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -135,7 +135,7 @@ G_DEFINE_TYPE_WITH_CODE (NMSettingsConnection, nm_settings_connection, NM_TYPE_D
const char *__uuid = (self) ? nm_settings_connection_get_uuid (self) : NULL; \
\
if (self) { \
- g_snprintf (__prefix, sizeof (__prefix), "%s[%p%s%s]", _NMLOG_PREFIX_NAME, self, __uuid ? "," : "", __uuid ? __uuid : ""); \
+ g_snprintf (__prefix, sizeof (__prefix), "%s[%p%s%s]", _NMLOG_PREFIX_NAME, self, __uuid ? "," : "", __uuid ?: ""); \
__p_prefix = __prefix; \
} \
_nm_log (__level, _NMLOG_DOMAIN, 0, NULL, __uuid, \
@@ -463,7 +463,7 @@ update_agent_secrets_cache (NMSettingsConnection *self, NMConnection *new)
if (priv->agent_secrets)
g_object_unref (priv->agent_secrets);
- priv->agent_secrets = nm_simple_connection_new_clone (new ? new : NM_CONNECTION (self));
+ priv->agent_secrets = nm_simple_connection_new_clone (new ?: NM_CONNECTION(self));
/* Clear out non-system-owned secrets */
nm_connection_clear_secrets_with_flags (priv->agent_secrets,
@@ -1883,7 +1883,7 @@ settings_connection_update (NMSettingsConnection *self,
* that's sending the update request. You can't make a connection
* invisible to yourself.
*/
- if (!nm_auth_is_subject_in_acl_set_error (tmp ? tmp : NM_CONNECTION (self),
+ if (!nm_auth_is_subject_in_acl_set_error (tmp ?: NM_CONNECTION(self),
subject,
NM_SETTINGS_ERROR,
NM_SETTINGS_ERROR_PERMISSION_DENIED,
@@ -1899,7 +1899,7 @@ settings_connection_update (NMSettingsConnection *self,
info->new_settings = tmp;
permission = get_update_modify_permission (NM_CONNECTION (self),
- tmp ? tmp : NM_CONNECTION (self));
+ tmp ?: NM_CONNECTION(self));
auth_start (self, context, subject, permission, update_auth_cb, info);
return;
diff --git a/src/settings/plugins/ibft/nms-ibft-reader.c b/src/settings/plugins/ibft/nms-ibft-reader.c
index d26c833473..cf849e2817 100644
--- a/src/settings/plugins/ibft/nms-ibft-reader.c
+++ b/src/settings/plugins/ibft/nms-ibft-reader.c
@@ -128,7 +128,7 @@ nms_ibft_reader_load_blocks (const char *iscsiadm_path,
}
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED,
"iBFT: %s exited with error %d. Message: '%s'",
- iscsiadm_path, WEXITSTATUS (status), err ? err : "(none)");
+ iscsiadm_path, WEXITSTATUS (status), err ?: "(none)");
goto done;
}
@@ -392,15 +392,15 @@ connection_setting_add (const GPtrArray *block,
id = g_strdup_printf ("iBFT%s%s %s",
prefix ? " " : "",
- prefix ? prefix : "",
+ prefix ?: "",
iface);
uuid = _nm_utils_uuid_generate_from_strings ("ibft",
s_hwaddr,
s_vlanid ? "V" : "v",
- s_vlanid ? s_vlanid : "",
+ s_vlanid ?: "",
s_ip4addr ? "A" : "DHCP",
- s_ip4addr ? s_ip4addr : "",
+ s_ip4addr ?: "",
NULL);
s_con = nm_setting_connection_new ();
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
index 8f42bd7e91..c1e00981af 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
@@ -418,7 +418,7 @@ ifcfg_dir_changed (GFileMonitor *monitor,
path = g_file_get_path (file);
ifcfg_path = utils_detect_ifcfg_path (path, FALSE);
- _LOGD ("ifcfg_dir_changed(%s) = %d // %s", path, event_type, ifcfg_path ? ifcfg_path : "(none)");
+ _LOGD ("ifcfg_dir_changed(%s) = %d // %s", path, event_type, ifcfg_path ?: "(none)");
if (ifcfg_path) {
connection = find_by_path (plugin, ifcfg_path);
switch (event_type) {
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
index 11474c3da7..722d4e366d 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
@@ -386,7 +386,7 @@ is_any_ip4_address_defined (shvarFile *ifcfg, int *idx)
{
int i, ignore, *ret_idx;
- ret_idx = idx ? idx : &ignore;
+ ret_idx = idx ?: &ignore;
for (i = -1; i <= 2; i++) {
gs_free char *value = NULL;
@@ -1847,8 +1847,8 @@ make_ip6_setting (shvarFile *ifcfg,
ipv6addr_secondaries = svGetValueStr_cp (ifcfg, "IPV6ADDR_SECONDARIES");
value = g_strjoin (ipv6addr && ipv6addr_secondaries ? " " : NULL,
- ipv6addr ? ipv6addr : "",
- ipv6addr_secondaries ? ipv6addr_secondaries : "",
+ ipv6addr ?: "",
+ ipv6addr_secondaries ?: "",
NULL);
g_free (ipv6addr);
g_free (ipv6addr_secondaries);
@@ -4524,9 +4524,9 @@ handle_bond_option (NMSettingBond *s_bond,
}
}
- if (!nm_setting_bond_add_option (s_bond, key, sanitized ? sanitized : value))
+ if (!nm_setting_bond_add_option (s_bond, key, sanitized ?: value))
PARSE_WARNING ("invalid bonding option '%s' = %s",
- key, sanitized ? sanitized : value);
+ key, sanitized ?: value);
g_free (sanitized);
}
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index 4fc0df0313..367de7ccc0 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -4590,7 +4590,7 @@ test_write_wired_static_ip6_only_gw (gconstpointer user_data)
s_con = (NMSettingConnection *) nm_setting_connection_new ();
nm_connection_add_setting (connection, NM_SETTING (s_con));
- id = g_strdup_printf ("Test Write Wired Static IP6 Only With Gateway %s", gateway6 ? gateway6 : "NULL");
+ id = g_strdup_printf ("Test Write Wired Static IP6 Only With Gateway %s", gateway6 ?: "NULL");
g_object_set (s_con,
NM_SETTING_CONNECTION_ID, id,
NM_SETTING_CONNECTION_UUID, nm_utils_uuid_generate_a (),
diff --git a/src/settings/plugins/ifupdown/nms-ifupdown-parser.c b/src/settings/plugins/ifupdown/nms-ifupdown-parser.c
index 37bd64273e..884c6591a9 100644
--- a/src/settings/plugins/ifupdown/nms-ifupdown-parser.c
+++ b/src/settings/plugins/ifupdown/nms-ifupdown-parser.c
@@ -338,7 +338,7 @@ update_wireless_security_setting_from_if_block(NMConnection *connection,
}
g_object_set(wireless_security_setting,
- newkey, typed_property_value ? typed_property_value : property_value,
+ newkey, typed_property_value ?: property_value,
NULL);
security = TRUE;
@@ -386,7 +386,7 @@ update_wireless_security_setting_from_if_block(NMConnection *connection,
}
g_object_set(wireless_security_setting,
- newkey, typed_property_value ? typed_property_value : property_value,
+ newkey, typed_property_value ?: property_value,
NULL);
security = TRUE;
diff --git a/src/supplicant/nm-supplicant-config.c b/src/supplicant/nm-supplicant-config.c
index d8cf28c362..80db5baa1c 100644
--- a/src/supplicant/nm-supplicant-config.c
+++ b/src/supplicant/nm-supplicant-config.c
@@ -144,7 +144,7 @@ nm_supplicant_config_add_option_with_type (NMSupplicantConfig *self,
memset (&buf[0], 0, sizeof (buf));
memcpy (&buf[0], value, len > 254 ? 254 : len);
g_set_error (error, NM_SUPPLICANT_ERROR, NM_SUPPLICANT_ERROR_CONFIG,
- "key '%s' and/or value '%s' invalid", key, hidden ? hidden : buf);
+ "key '%s' and/or value '%s' invalid", key, hidden ?: buf);
return FALSE;
}
}
@@ -168,7 +168,7 @@ nm_supplicant_config_add_option_with_type (NMSupplicantConfig *self,
char buf[255];
memset (&buf[0], 0, sizeof (buf));
memcpy (&buf[0], opt->value, opt->len > 254 ? 254 : opt->len);
- nm_log_info (LOGD_SUPPLICANT, "Config: added '%s' value '%s'", key, hidden ? hidden : &buf[0]);
+ nm_log_info (LOGD_SUPPLICANT, "Config: added '%s' value '%s'", key, hidden ?: &buf[0]);
}
g_hash_table_insert (priv->config, g_strdup (key), opt);
@@ -979,7 +979,7 @@ add_pkcs11_uri_with_pin (NMSupplicantConfig *self,
tmp = g_strdup_printf ("%s%s%s", split[0],
(pin_qattr ? "?" : ""),
- (pin_qattr ? pin_qattr : ""));
+ (pin_qattr ?: ""));
tmp_log = g_strdup_printf ("%s%s%s", split[0],
(pin_qattr ? "?" : ""),
@@ -1171,7 +1171,7 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self,
/* CA path */
path = nm_setting_802_1x_get_ca_path (setting);
- path = ca_path_override ? ca_path_override : path;
+ path = ca_path_override ?: path;
if (path) {
if (!add_string_val (self, path, "ca_path", FALSE, NULL, error))
return FALSE;
@@ -1179,7 +1179,7 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self,
/* Phase2 CA path */
path = nm_setting_802_1x_get_phase2_ca_path (setting);
- path = ca_path_override ? ca_path_override : path;
+ path = ca_path_override ?: path;
if (path) {
if (!add_string_val (self, path, "ca_path2", FALSE, NULL, error))
return FALSE;
diff --git a/src/supplicant/nm-supplicant-settings-verify.c b/src/supplicant/nm-supplicant-settings-verify.c
index 1db45dc8a0..317afff9d1 100644
--- a/src/supplicant/nm-supplicant-settings-verify.c
+++ b/src/supplicant/nm-supplicant-settings-verify.c
@@ -187,7 +187,7 @@ validate_type_bytes (const struct Opt * opt,
g_return_val_if_fail (opt != NULL, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
- check_len = opt->int_high ? opt->int_high : 255;
+ check_len = opt->int_high ?: 255;
if (len > check_len)
return FALSE;
@@ -204,7 +204,7 @@ validate_type_utf8 (const struct Opt *opt,
g_return_val_if_fail (opt != NULL, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
- check_len = opt->int_high ? opt->int_high : 255;
+ check_len = opt->int_high ?: 255;
/* Note that we deliberately don't validate the UTF-8, because
some "UTF-8" fields, such as 8021x.password, do not actually
have to be valid UTF-8 */
diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c
index 7d6be84d79..ad752c4c1f 100644
--- a/src/vpn/nm-vpn-connection.c
+++ b/src/vpn/nm-vpn-connection.c
@@ -1022,7 +1022,7 @@ print_vpn_config (NMVpnConnection *self)
if (nm_ip4_config_get_num_domains (priv->ip4_config) > 0)
dns_domain = (char *) nm_ip4_config_get_domain (priv->ip4_config, 0);
- _LOGI ("Data: DNS Domain: '%s'", dns_domain ? dns_domain : "(none)");
+ _LOGI ("Data: DNS Domain: '%s'", dns_domain ?: "(none)");
} else
_LOGI ("Data: No IPv4 configuration");
@@ -1056,7 +1056,7 @@ print_vpn_config (NMVpnConnection *self)
if (nm_ip6_config_get_num_domains (priv->ip6_config) > 0)
dns_domain = (char *) nm_ip6_config_get_domain (priv->ip6_config, 0);
- _LOGI ("Data: DNS Domain: '%s'", dns_domain ? dns_domain : "(none)");
+ _LOGI ("Data: DNS Domain: '%s'", dns_domain ?: "(none)");
} else
_LOGI ("Data: No IPv6 configuration");
@@ -2821,7 +2821,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_uint (value, _state_to_nm_vpn_state (priv->vpn_state));
break;
case PROP_BANNER:
- g_value_set_string (value, priv->banner ? priv->banner : "");
+ g_value_set_string (value, priv->banner ?: "");
break;
case PROP_IP4_CONFIG:
nm_dbus_utils_g_value_set_object_path (value, ip_config_valid (priv->vpn_state) ? priv->ip4_config : NULL);