summaryrefslogtreecommitdiff
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
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.
-rw-r--r--clients/cli/connections.c20
-rw-r--r--clients/cli/devices.c6
-rw-r--r--clients/cli/general.c4
-rw-r--r--clients/cli/settings.c4
-rw-r--r--clients/cli/utils.c2
-rw-r--r--clients/common/nm-meta-setting-desc.c2
-rw-r--r--clients/common/nm-vpn-helpers.c2
-rw-r--r--clients/tui/newt/nmt-newt-utils.c6
-rw-r--r--clients/tui/nmt-connect-connection-list.c6
-rw-r--r--dispatcher/nm-dispatcher.c8
-rw-r--r--dispatcher/tests/test-dispatcher-envp.c2
-rw-r--r--examples/C/glib/get-ap-info-libnm.c2
-rw-r--r--libnm-core/nm-connection.c2
-rw-r--r--libnm-core/nm-keyfile-utils.c4
-rw-r--r--libnm-core/nm-keyfile.c8
-rw-r--r--libnm-core/nm-setting-adsl.c2
-rw-r--r--libnm-core/nm-utils.c6
-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
-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
-rw-r--r--libnm/nm-manager.c4
-rw-r--r--libnm/nm-object.c2
-rw-r--r--libnm/nm-remote-settings.c4
-rw-r--r--libnm/nm-secret-agent-old.c2
-rw-r--r--shared/nm-utils/nm-test-utils.h4
-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
62 files changed, 139 insertions, 141 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index c509c6a92..47e608b7b 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -1275,7 +1275,7 @@ nmc_active_connection_details (NMActiveConnection *acon, NmCli *nmc)
arr = nmc_dup_fields_array (tmpl, NMC_OF_FLAG_SECTION_PREFIX);
set_val_strc (arr, 0, nmc_fields_con_active_details_groups[5]->name);
set_val_str (arr, 1, type_str);
- set_val_strc (arr, 2, username ? username : get_vpn_data_item (con, VPN_DATA_ITEM_USERNAME));
+ set_val_strc (arr, 2, username ?: get_vpn_data_item (con, VPN_DATA_ITEM_USERNAME));
set_val_strc (arr, 3, get_vpn_data_item (con, VPN_DATA_ITEM_GATEWAY));
set_val_str (arr, 4, banner_str);
set_val_str (arr, 5, vpn_state_str);
@@ -4248,7 +4248,7 @@ nmc_read_connection_properties (NmCli *nmc,
return FALSE;
if (!*argc && nmc->complete)
- complete_property (setting, strv[1], value ? value : "", connection);
+ complete_property (setting, strv[1], value ?: "", connection);
if (!set_property (connection, setting_name, strv[1], value, modifier, error))
return FALSE;
@@ -4329,7 +4329,7 @@ nmc_read_connection_properties (NmCli *nmc,
return FALSE;
if (!*argc && nmc->complete)
- complete_option (chosen, value ? value : "", connection);
+ complete_option (chosen, value ?: "", connection);
if (!set_option (nmc, connection, chosen, value, error))
return FALSE;
@@ -7014,7 +7014,7 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
/* in top level - no setting selected yet */
const char *setting_name;
NMSetting *setting;
- const char *user_arg = cmd_arg_s ? cmd_arg_s : cmd_arg_p;
+ const char *user_arg = cmd_arg_s ?: cmd_arg_p;
setting_name = ask_check_setting (user_arg,
valid_settings_main,
@@ -7106,7 +7106,7 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
/* cmd_arg_s != NULL means argument is "setting.property" */
descr_all = !cmd_arg_s && !menu_ctx.curr_setting;
- user_s = descr_all ? cmd_arg_p : cmd_arg_s ? cmd_arg_s : NULL;
+ user_s = descr_all ? cmd_arg_p : cmd_arg_s;
if (user_s) {
ss = is_setting_valid (connection,
valid_settings_main,
@@ -7199,7 +7199,7 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
/* cmd_arg_s != NULL means argument is "setting.property" */
descr_all = !cmd_arg_s && !menu_ctx.curr_setting;
- user_s = descr_all ? cmd_arg_p : cmd_arg_s ? cmd_arg_s : NULL;
+ user_s = descr_all ? cmd_arg_p : cmd_arg_s;
if (user_s) {
ss = is_setting_valid (connection,
valid_settings_main,
@@ -7265,7 +7265,7 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
/* cmd_arg_s != NULL means argument is "setting.property" */
whole_setting = !cmd_arg_s && !menu_ctx.curr_setting;
- user_s = whole_setting ? cmd_arg_p : cmd_arg_s ? cmd_arg_s : NULL;
+ user_s = whole_setting ? cmd_arg_p : cmd_arg_s;
if (user_s) {
const char *s_name;
@@ -7583,7 +7583,7 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
nmc->editor_prompt_color);
} else
g_print (_("Invalid configuration option '%s'; allowed [%s]\n"),
- cmd_arg_v ? cmd_arg_v : "", "status-line, save-confirmation, show-secrets, prompt-color");
+ cmd_arg_v ?: "", "status-line, save-confirmation, show-secrets, prompt-color");
break;
@@ -7654,7 +7654,7 @@ editor_init_new_connection (NmCli *nmc, NMConnection *connection, const char *sl
g_object_set (s_con,
NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME,
- NM_SETTING_CONNECTION_MASTER, dev_ifname ? dev_ifname : "eth0",
+ NM_SETTING_CONNECTION_MASTER, dev_ifname ?: "eth0",
NM_SETTING_CONNECTION_SLAVE_TYPE, slave_type,
NULL);
} else {
@@ -7675,7 +7675,7 @@ editor_init_new_connection (NmCli *nmc, NMConnection *connection, const char *sl
const char *dev_ifname = get_ethernet_device_name (nmc);
g_object_set (NM_SETTING_VLAN (base_setting),
- NM_SETTING_VLAN_PARENT, dev_ifname ? dev_ifname : "eth0",
+ NM_SETTING_VLAN_PARENT, dev_ifname ?: "eth0",
NULL);
}
diff --git a/clients/cli/devices.c b/clients/cli/devices.c
index 43e10fe18..5ad546a28 100644
--- a/clients/cli/devices.c
+++ b/clients/cli/devices.c
@@ -1160,7 +1160,7 @@ show_device_info (NMDevice *device, NmCli *nmc)
set_val_strc (arr, 6, nm_device_get_driver (device) ? nm_device_get_driver (device) : _("(unknown)"));
set_val_strc (arr, 7, nm_device_get_driver_version (device));
set_val_strc (arr, 8, nm_device_get_firmware_version (device));
- set_val_strc (arr, 9, hwaddr ? hwaddr : _("(unknown)"));
+ set_val_strc (arr, 9, hwaddr ?: _("(unknown)"));
set_val_str (arr, 10, mtu_str);
set_val_str (arr, 11, state_str);
set_val_str (arr, 12, reason_str);
@@ -1268,7 +1268,7 @@ show_device_info (NMDevice *device, NmCli *nmc)
}
tmpl = (const NMMetaAbstractInfo *const*) nmc_fields_dev_wifi_list;
- out_indices = parse_output_fields (section_fld ? section_fld : NMC_FIELDS_DEV_WIFI_LIST_FOR_DEV_LIST,
+ out_indices = parse_output_fields (section_fld ?: NMC_FIELDS_DEV_WIFI_LIST_FOR_DEV_LIST,
tmpl, FALSE, NULL, NULL);
arr = nmc_dup_fields_array (tmpl, NMC_OF_FLAG_FIELD_NAMES);
g_ptr_array_add (out.output_data, arr);
@@ -2906,7 +2906,7 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
if (nmc->ask) {
ssid_ask = nmc_readline (_("SSID or BSSID: "));
- param_user = ssid_ask ? ssid_ask : "";
+ param_user = ssid_ask ?: "";
bssid1_arr = nm_utils_hwaddr_atoba (param_user, ETH_ALEN);
}
if (!ssid_ask) {
diff --git a/clients/cli/general.c b/clients/cli/general.c
index 3d3c6eaf6..17c0d7947 100644
--- a/clients/cli/general.c
+++ b/clients/cli/general.c
@@ -516,8 +516,8 @@ show_nm_status (NmCli *nmc, const char *pretty_header_name, const char *print_fl
{
gs_free_error GError *error = NULL;
const char *fields_str;
- const char *fields_all = print_flds ? print_flds : NMC_FIELDS_NM_STATUS_ALL;
- const char *fields_common = print_flds ? print_flds : NMC_FIELDS_NM_STATUS_COMMON;
+ const char *fields_all = print_flds ?: NMC_FIELDS_NM_STATUS_ALL;
+ const char *fields_common = print_flds ?: NMC_FIELDS_NM_STATUS_COMMON;
if (!nmc->required_fields || strcasecmp (nmc->required_fields, "common") == 0)
fields_str = fields_common;
diff --git a/clients/cli/settings.c b/clients/cli/settings.c
index 5c3deeadd..01142ba26 100644
--- a/clients/cli/settings.c
+++ b/clients/cli/settings.c
@@ -749,9 +749,9 @@ nmc_setting_get_property_desc (NMSetting *setting, const char *prop)
return g_strdup_printf ("%s\n%s\n%s%s%s%s",
setting_desc_title,
- setting_desc ? setting_desc : "",
+ setting_desc ?: "",
nmcli_nl, nmcli_desc_title, nmcli_nl,
- nmcli_desc ? nmcli_desc : "");
+ nmcli_desc ?: "");
}
/*
diff --git a/clients/cli/utils.c b/clients/cli/utils.c
index 4caadab2c..5101ab689 100644
--- a/clients/cli/utils.c
+++ b/clients/cli/utils.c
@@ -390,7 +390,7 @@ nmc_terminal_show_progress (const char *str)
const char slashes[4] = {'|', '/', '-', '\\'};
nmc_terminal_erase_line ();
- g_print ("%c %s", slashes[idx++], str ? str : "");
+ g_print ("%c %s", slashes[idx++], str ?: "");
fflush (stdout);
if (idx == 4)
idx = 0;
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index 2c8a5159d..2988b084b 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -2891,7 +2891,7 @@ dcb_parse_uint_array (const char *val,
*iter = g_strstrip (*iter);
- num = _nm_utils_ascii_str_to_int64 (*iter, 10, 0, other ? other : max, -1);
+ num = _nm_utils_ascii_str_to_int64 (*iter, 10, 0, other ?: max, -1);
/* If number is greater than 'max' it must equal 'other' */
if ( num == -1
diff --git a/clients/common/nm-vpn-helpers.c b/clients/common/nm-vpn-helpers.c
index 15611c45c..c3237f12b 100644
--- a/clients/common/nm-vpn-helpers.c
+++ b/clients/common/nm-vpn-helpers.c
@@ -238,7 +238,7 @@ nm_vpn_openconnect_authenticate_helper (const char *host,
* HOST='1.2.3.4'
* FINGERPRINT='sha1:32bac90cf09a722e10ecc1942c67fe2ac8c21e2e'
*/
- strv = g_strsplit_set (output ? output : "", "\r\n", 0);
+ strv = g_strsplit_set (output ?: "", "\r\n", 0);
for (iter = strv; iter && *iter; iter++) {
_extract_variable_value (*iter, "COOKIE=", cookie);
_extract_variable_value (*iter, "HOST=", gateway);
diff --git a/clients/tui/newt/nmt-newt-utils.c b/clients/tui/newt/nmt-newt-utils.c
index 112d25996..e88665003 100644
--- a/clients/tui/newt/nmt-newt-utils.c
+++ b/clients/tui/newt/nmt-newt-utils.c
@@ -65,9 +65,9 @@ nmt_newt_dialog_g_log_handler (const char *log_domain,
}
full_message = g_strdup_printf ("%s%s%s%s%s",
- log_domain ? log_domain : "",
+ log_domain ?: "",
log_domain && level_name ? " " : "",
- level_name ? level_name : "",
+ level_name ?: "",
log_domain || level_name ? ": " : "",
message);
@@ -87,7 +87,7 @@ nmt_newt_dialog_g_log_handler (const char *log_domain,
newtGridSetField (grid, 0, 1, NEWT_GRID_COMPONENT, ok, 0, 1, 0, 0,
NEWT_ANCHOR_RIGHT, 0);
- newtGridWrappedWindow (grid, (char *) (level_name ? level_name : ""));
+ newtGridWrappedWindow (grid, (char *) (level_name ?: ""));
newtGridFree (grid, TRUE);
form = newtForm (NULL, NULL, 0);
diff --git a/clients/tui/nmt-connect-connection-list.c b/clients/tui/nmt-connect-connection-list.c
index cced55fc2..ae633ec0b 100644
--- a/clients/tui/nmt-connect-connection-list.c
+++ b/clients/tui/nmt-connect-connection-list.c
@@ -307,7 +307,7 @@ add_connections_for_aps (NmtConnectDevice *nmtdev,
}
if (!nmtconn->name)
- nmtconn->name = nmtconn->ssid ? nmtconn->ssid : "<unknown>";
+ nmtconn->name = nmtconn->ssid ?: "<unknown>";
nmtdev->conns = g_slist_prepend (nmtdev->conns, nmtconn);
}
@@ -376,7 +376,7 @@ append_nmt_devices_for_virtual_devices (GSList *nmt_devices,
g_free (name);
else {
nmtdev = g_slice_new0 (NmtConnectDevice);
- nmtdev->name = name ? name : g_strdup ("Unknown");
+ nmtdev->name = name ?: g_strdup("Unknown");
nmtdev->sort_order = sort_order;
g_hash_table_insert (devices_by_name, nmtdev->name, nmtdev);
@@ -533,7 +533,7 @@ nmt_connect_connection_list_rebuild (NmtConnectConnectionList *list)
nmtconn->name,
(int)(max_width - nmt_newt_text_width (nmtconn->name)), "",
strength_col ? " " : "",
- strength_col ? strength_col : "");
+ strength_col ?: "");
nmt_newt_listbox_append (listbox, row, nmtconn);
g_free (row);
diff --git a/dispatcher/nm-dispatcher.c b/dispatcher/nm-dispatcher.c
index ca11523ab..899669530 100644
--- a/dispatcher/nm-dispatcher.c
+++ b/dispatcher/nm-dispatcher.c
@@ -144,7 +144,7 @@ struct Request {
(_request)->request_id, \
(_request)->action, \
(_request)->iface ? " [" : "", \
- (_request)->iface ? (_request)->iface : "", \
+ (_request)->iface ?: "", \
(_request)->iface ? "]" : "", \
(_script) ? ", \"" : "", \
(_script) ? (_script)->script : "", \
@@ -297,7 +297,7 @@ complete_request (Request *request)
g_variant_builder_add (&results, "(sus)",
script->script,
script->result,
- script->error ? script->error : "");
+ script->error ?: "");
}
ret = g_variant_new ("(a(sus))", &results);
@@ -537,9 +537,7 @@ script_dispatch (ScriptInfo *script)
script->dispatched = TRUE;
argv[0] = script->script;
- argv[1] = request->iface
- ? request->iface
- : (!strcmp (request->action, NMD_ACTION_HOSTNAME) ? "none" : "");
+ argv[1] = request->iface ?: (!strcmp(request->action, NMD_ACTION_HOSTNAME) ? "none" : "");
argv[2] = request->action;
argv[3] = NULL;
diff --git a/dispatcher/tests/test-dispatcher-envp.c b/dispatcher/tests/test-dispatcher-envp.c
index 25cd5e60c..936b6e93f 100644
--- a/dispatcher/tests/test-dispatcher-envp.c
+++ b/dispatcher/tests/test-dispatcher-envp.c
@@ -543,7 +543,7 @@ test_generic (const char *file, const char *override_vpn_ip_iface)
device_dhcp4_props,
device_dhcp6_props,
connectivity_change,
- override_vpn_ip_iface ? override_vpn_ip_iface : vpn_ip_iface,
+ override_vpn_ip_iface ?: vpn_ip_iface,
vpn_proxy_props,
vpn_ip4_props,
vpn_ip6_props,
diff --git a/examples/C/glib/get-ap-info-libnm.c b/examples/C/glib/get-ap-info-libnm.c
index b312356c7..c11d41465 100644
--- a/examples/C/glib/get-ap-info-libnm.c
+++ b/examples/C/glib/get-ap-info-libnm.c
@@ -180,7 +180,7 @@ show_wifi_device_info (NMDevice *device)
speed /= 1000;
printf ("Device: %s ---- Driver: %s ---- Speed: %d Mbit/s ---- Active AP: %s\n",
- iface, driver, speed, active_ssid_str ? active_ssid_str : "none");
+ iface, driver, speed, active_ssid_str ?: "none");
printf ("=================================================================================\n");
g_free (active_ssid_str);
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c
index 80c21d91b..790e98b80 100644
--- a/libnm-core/nm-connection.c
+++ b/libnm-core/nm-connection.c
@@ -1530,7 +1530,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_dict ? setting_dict : secrets,
+ setting_dict ?: secrets,
error);
g_signal_handlers_unblock_by_func (setting, (GCallback) setting_changed_cb, connection);
diff --git a/libnm-core/nm-keyfile-utils.c b/libnm-core/nm-keyfile-utils.c
index cd937c67a..5000b5831 100644
--- a/libnm-core/nm-keyfile-utils.c
+++ b/libnm-core/nm-keyfile-utils.c
@@ -106,7 +106,7 @@ nm_keyfile_plugin_kf_set_##stype##_list (GKeyFile *kf, \
const char *alias; \
\
alias = nm_keyfile_plugin_get_alias_for_setting_name (group); \
- g_key_file_set_##stype##_list (kf, alias ? alias : group, key, list, length); \
+ g_key_file_set_##stype##_list (kf, alias ?: group, key, list, length); \
}
DEFINE_KF_LIST_WRAPPER(integer, gint*, gint);
@@ -170,7 +170,7 @@ nm_keyfile_plugin_kf_set_##stype (GKeyFile *kf, \
const char *alias; \
\
alias = nm_keyfile_plugin_get_alias_for_setting_name (group); \
- g_key_file_set_##stype (kf, alias ? alias : group, key, value); \
+ g_key_file_set_##stype (kf, alias ?: group, key, value); \
}
DEFINE_KF_WRAPPER(string, gchar*, const gchar*);
diff --git a/libnm-core/nm-keyfile.c b/libnm-core/nm-keyfile.c
index 3a84bd011..5c94c35c3 100644
--- a/libnm-core/nm-keyfile.c
+++ b/libnm-core/nm-keyfile.c
@@ -112,7 +112,7 @@ setting_alias_parser (KeyfileReaderInfo *info, NMSetting *setting, const char *k
if (s) {
key_setting_name = nm_keyfile_plugin_get_setting_name_for_alias (s);
g_object_set (G_OBJECT (setting),
- key, key_setting_name ? key_setting_name : s,
+ key, key_setting_name ?: s,
NULL);
g_free (s);
}
@@ -358,7 +358,7 @@ read_one_ip_address_or_route (KeyfileReaderInfo *info,
gs_free char *value = NULL;
gs_free char *value_orig = NULL;
-#define VALUE_ORIG() (value_orig ? value_orig : (value_orig = nm_keyfile_plugin_kf_get_string (info->keyfile, setting_name, key_name, NULL)))
+#define VALUE_ORIG() (value_orig ?: (value_orig = nm_keyfile_plugin_kf_get_string (info->keyfile, setting_name, key_name, NULL)))
value = nm_keyfile_plugin_kf_get_string (info->keyfile, setting_name, key_name, NULL);
if (!value)
@@ -1363,7 +1363,7 @@ parity_parser (KeyfileReaderInfo *info, NMSetting *setting, const char *key)
default:
handle_warn (info, key, NM_KEYFILE_WARN_SEVERITY_WARN,
_("invalid parity value '%s'"),
- str_val ? str_val : "");
+ str_val ?: "");
return;
}
@@ -1506,7 +1506,7 @@ setting_alias_writer (KeyfileWriterInfo *info,
nm_keyfile_plugin_kf_set_string (info->keyfile,
nm_setting_get_name (setting),
key,
- alias ? alias : str);
+ alias ?: str);
}
static void
diff --git a/libnm-core/nm-setting-adsl.c b/libnm-core/nm-setting-adsl.c
index 8be288b66..c2eb5db41 100644
--- a/libnm-core/nm-setting-adsl.c
+++ b/libnm-core/nm-setting-adsl.c
@@ -206,7 +206,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
NM_CONNECTION_ERROR,
NM_CONNECTION_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-core/nm-utils.c b/libnm-core/nm-utils.c
index f9c3eb1c6..a6d6486fa 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -4318,7 +4318,7 @@ nm_utils_inet_ntop (int addr_family, gconstpointer addr, char *dst)
s = inet_ntop (addr_family,
addr,
- dst ? dst : _nm_utils_inet_ntop_buffer,
+ dst ?: _nm_utils_inet_ntop_buffer,
addr_family == AF_INET6 ? INET6_ADDRSTRLEN : INET_ADDRSTRLEN);
nm_assert (s);
return s;
@@ -4344,7 +4344,7 @@ nm_utils_inet_ntop (int addr_family, gconstpointer addr, char *dst)
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);
}
@@ -4370,7 +4370,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-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;
}
diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c
index 726cebdca..3ddea2d74 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 5c1775709..f2305b38d 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 584049102..54e0cc9a8 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 2d31f1296..13f9eb43b 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));
diff --git a/libnm/nm-manager.c b/libnm/nm-manager.c
index 2b9e0d969..aac120c6e 100644
--- a/libnm/nm-manager.c
+++ b/libnm/nm-manager.c
@@ -1049,7 +1049,7 @@ nm_manager_activate_connection_async (NMManager *manager,
nmdbus_manager_call_activate_connection (priv->proxy,
connection ? nm_connection_get_path (connection) : "/",
device ? nm_object_get_path (NM_OBJECT (device)) : "/",
- specific_object ? specific_object : "/",
+ specific_object ?: "/",
cancellable,
activate_cb, info);
}
@@ -1133,7 +1133,7 @@ nm_manager_add_and_activate_connection_async (NMManager *manager,
nmdbus_manager_call_add_and_activate_connection (priv->proxy,
dict,
nm_object_get_path (NM_OBJECT (device)),
- specific_object ? specific_object : "/",
+ specific_object ?: "/",
cancellable,
add_activate_cb, info);
}
diff --git a/libnm/nm-object.c b/libnm/nm-object.c
index 605da4927..f162b15dc 100644
--- a/libnm/nm-object.c
+++ b/libnm/nm-object.c
@@ -968,7 +968,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;
diff --git a/libnm/nm-remote-settings.c b/libnm/nm-remote-settings.c
index 089a06337..f2b26215c 100644
--- a/libnm/nm-remote-settings.c
+++ b/libnm/nm-remote-settings.c
@@ -538,7 +538,7 @@ nm_remote_settings_save_hostname (NMRemoteSettings *settings,
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
ret = nmdbus_settings_call_save_hostname_sync (priv->proxy,
- hostname ? hostname : "",
+ hostname ?: "",
cancellable, error);
if (error && *error)
g_dbus_error_strip_remote_error (*error);
@@ -583,7 +583,7 @@ nm_remote_settings_save_hostname_async (NMRemoteSettings *settings,
g_simple_async_result_set_check_cancellable (simple, cancellable);
nmdbus_settings_call_save_hostname (priv->proxy,
- hostname ? hostname : "",
+ hostname ?: "",
cancellable, save_hostname_cb, simple);
}
diff --git a/libnm/nm-secret-agent-old.c b/libnm/nm-secret-agent-old.c
index 749145126..1b9e8915b 100644
--- a/libnm/nm-secret-agent-old.c
+++ b/libnm/nm-secret-agent-old.c
@@ -224,7 +224,7 @@ verify_sender (NMSecretAgentOld *self,
NM_SECRET_AGENT_ERROR,
NM_SECRET_AGENT_ERROR_PERMISSION_DENIED,
"Failed to request unix user: (%s) %s.",
- remote_error ? remote_error : "",
+ remote_error ?: "",
local->message);
g_free (remote_error);
g_error_free (local);
diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h
index 244e0ac2c..6dd337b20 100644
--- a/shared/nm-utils/nm-test-utils.h
+++ b/shared/nm-utils/nm-test-utils.h
@@ -1138,7 +1138,7 @@ _nmtst_assert_ip4_address (const char *file, int line, in_addr_t addr, const cha
char buf[100];
g_error ("%s:%d: Unexpected IPv4 address: expected %s, got %s",
- file, line, str_expected ? str_expected : "0.0.0.0",
+ file, line, str_expected ?: "0.0.0.0",
inet_ntop (AF_INET, &addr, buf, sizeof (buf)));
}
}
@@ -1156,7 +1156,7 @@ _nmtst_assert_ip6_address (const char *file, int line, const struct in6_addr *ad
char buf[100];
g_error ("%s:%d: Unexpected IPv6 address: expected %s, got %s",
- file, line, str_expected ? str_expected : "::",
+ file, line, str_expected ?: "::",
inet_ntop (AF_INET6, addr, buf, sizeof (buf)));
}
}
diff --git a/src/devices/adsl/nm-atm-manager.c b/src/devices/adsl/nm-atm-manager.c
index 32c4c386d..0ff4603df 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 913313768..5fcc823a2 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 cc9e38c89..d8e40d6f3 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 2dd9494a8..22f7cdde3 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 ed63adf54..398075863 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 12e7c1f15..a9cb57034 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 1590f1662..90f945574 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 a58eb7875..e5678b963 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 61b7247ec..80336d720 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 96c026538..f407da89a 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 d7d38e546..1770ead34 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 bf22872d4..aa40e8037 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 714d7bcf4..c1267b275 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 bef05fc78..d4682ed6d 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 548101e7b..0e3f5cc91 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 488eb827d..a9a70038f 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 235134c87..368b781ad 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 134a46f7e..5b5e7cfa2 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 8c9eb890b..9f0891a75 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 55b6caf60..61cc001f0 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 e655e67cc..b2909e9d3 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 c6413d967..3a671acf7 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 c71bda4d0..727e064bd 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 7885c083b..42569d5b1 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 abc7c524b..6526abc76 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 d26c83347..cf849e281 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 8f42bd7e9..c1e00981a 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 11474c3da..722d4e366 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 4fc0df031..367de7ccc 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 37bd64273..884c6591a 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 d8cf28c36..80db5baa1 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 1db45dc8a..317afff9d 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 7d6be84d7..ad752c4c1 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);