keyfile: use nm_g_error_matches() in g_error_matches()

nm_g_error_matches() can be inlined and first checks whether the error
argument is not NULL. At least from the keyfile accessor functions, use
this macro, as they are called many times.
This commit is contained in:
Thomas Haller 2020-05-05 08:32:29 +02:00
parent e08bb66b34
commit 5cdb636301
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -117,7 +117,7 @@ nm_keyfile_plugin_kf_get_string_list (GKeyFile *kf,
gsize l;
list = g_key_file_get_string_list (kf, group, key, &l, &local);
if (g_error_matches (local, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
if (nm_g_error_matches (local, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
alias = nm_keyfile_plugin_get_alias_for_setting_name (group);
if (alias) {
g_clear_error (&local);
@ -246,7 +246,7 @@ fcn_name (GKeyFile *kf, \
GError *local = NULL; \
\
val = key_file_get_fcn (kf, group, key, &local); \
if (g_error_matches (local, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) { \
if (nm_g_error_matches (local, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) { \
alias = nm_keyfile_plugin_get_alias_for_setting_name (group); \
if (alias) { \
g_clear_error (&local); \
@ -323,7 +323,7 @@ nm_keyfile_plugin_kf_get_keys (GKeyFile *kf,
gsize l;
keys = g_key_file_get_keys (kf, group, &l, &local);
if (g_error_matches (local, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
if (nm_g_error_matches (local, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
alias = nm_keyfile_plugin_get_alias_for_setting_name (group);
if (alias) {
g_clear_error (&local);
@ -351,7 +351,7 @@ nm_keyfile_plugin_kf_has_key (GKeyFile *kf,
GError *local = NULL;
has = g_key_file_has_key (kf, group, key, &local);
if (g_error_matches (local, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
if (nm_g_error_matches (local, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
alias = nm_keyfile_plugin_get_alias_for_setting_name (group);
if (alias) {
g_clear_error (&local);