diff options
author | Frediano Ziglio <freddy77@gmail.com> | 2020-04-17 09:46:37 +0100 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2020-04-17 13:12:12 +0100 |
commit | 936519e55c24314a28faed6caf34fbac120bb89a (patch) | |
tree | b10406bfbd8f7663a97f2395ff6667488155b539 /src | |
parent | 30bdd7c9e31bb3a79ba6ccd876e172f2c72c1352 (diff) |
Cache g_get_system_config_dirs results
Do not call the function 3 times in a row.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vcard_emul_nss.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/vcard_emul_nss.c b/src/vcard_emul_nss.c index e633227..f7a286f 100644 --- a/src/vcard_emul_nss.c +++ b/src/vcard_emul_nss.c @@ -1000,13 +1000,12 @@ vcard_emul_init(const VCardEmulOptions *options) #ifndef _WIN32 path = g_strdup("/etc/pki/nssdb"); #else - if (g_get_system_config_dirs() == NULL || - g_get_system_config_dirs()[0] == NULL) { + const gchar * const *config_dirs = g_get_system_config_dirs(); + if (config_dirs == NULL || config_dirs[0] == NULL) { return VCARD_EMUL_FAIL; } - path = g_build_filename( - g_get_system_config_dirs()[0], "pki", "nssdb", NULL); + path = g_build_filename(config_dirs[0], "pki", "nssdb", NULL); #endif nss_ctx = NSS_InitContext(path, "", "", "", NULL, NSS_INIT_READONLY); |