From 5cdb636301f934aaa7dbf39340d721e438f76c7d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 5 May 2020 08:32:29 +0200 Subject: [PATCH] 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. --- shared/nm-keyfile/nm-keyfile-utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/nm-keyfile/nm-keyfile-utils.c b/shared/nm-keyfile/nm-keyfile-utils.c index 45235495a6..0ffce40b96 100644 --- a/shared/nm-keyfile/nm-keyfile-utils.c +++ b/shared/nm-keyfile/nm-keyfile-utils.c @@ -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);