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.
This commit is contained in:
@@ -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*);
|
||||
|
Reference in New Issue
Block a user