diff options
author | Thomas Haller <thaller@redhat.com> | 2020-04-30 15:39:25 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-05-04 13:12:43 +0200 |
commit | 3ebfb67df4bb7a53fcf0b42fa707b26071670ead (patch) | |
tree | ed89b528bb533e8da99493f15410c73fc9b38a44 | |
parent | dade5055fb4d859d69d6f3ec07eff3d0ce27b208 (diff) | |
download | NetworkManager-3ebfb67df4bb7a53fcf0b42fa707b26071670ead.tar.gz |
keyfile: implement nm_keyfile_plugin_kf_get_string_list() directly without macro
There is only one user of the macro left. Drop it.
-rw-r--r-- | shared/nm-keyfile/nm-keyfile-utils.c | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/shared/nm-keyfile/nm-keyfile-utils.c b/shared/nm-keyfile/nm-keyfile-utils.c index c28af81541..45235495a6 100644 --- a/shared/nm-keyfile/nm-keyfile-utils.c +++ b/shared/nm-keyfile/nm-keyfile-utils.c @@ -104,36 +104,33 @@ nm_keyfile_plugin_get_setting_name_for_alias (const char *alias) /*****************************************************************************/ -#define DEFINE_KF_LIST_WRAPPER_GET(fcn_name, get_ctype, key_file_get_fcn) \ -get_ctype \ -fcn_name (GKeyFile *kf, \ - const char *group, \ - const char *key, \ - gsize *out_length, \ - GError **error) \ -{ \ - get_ctype list; \ - const char *alias; \ - GError *local = NULL; \ - gsize l; \ -\ - list = key_file_get_fcn (kf, group, key, &l, &local); \ - if (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); \ - list = key_file_get_fcn (kf, alias, key, &l, &local); \ - } \ - } \ - if (local) \ - g_propagate_error (error, local); \ - if (!list) \ - l = 0; \ - NM_SET_OUT (out_length, l); \ - return list; \ -} +char ** +nm_keyfile_plugin_kf_get_string_list (GKeyFile *kf, + const char *group, + const char *key, + gsize *out_length, + GError **error) +{ + char **list; + const char *alias; + GError *local = NULL; + gsize l; -DEFINE_KF_LIST_WRAPPER_GET (nm_keyfile_plugin_kf_get_string_list, char **, g_key_file_get_string_list); + 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)) { + alias = nm_keyfile_plugin_get_alias_for_setting_name (group); + if (alias) { + g_clear_error (&local); + list = g_key_file_get_string_list (kf, alias, key, &l, &local); + } + } + if (local) + g_propagate_error (error, local); + if (!list) + l = 0; + NM_SET_OUT (out_length, l); + return list; +} guint * nm_keyfile_plugin_kf_get_integer_list_uint (GKeyFile *key_file, |