Avoid allocating GError in utils_get_setting_string().
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4341 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
7c450e2939
commit
e9547d1664
@ -806,15 +806,13 @@ gchar *utils_get_setting_string(GKeyFile *config, const gchar *section, const gc
|
||||
const gchar *default_value)
|
||||
{
|
||||
gchar *tmp;
|
||||
GError *error = NULL;
|
||||
|
||||
if (G_UNLIKELY(config == NULL))
|
||||
return g_strdup(default_value);
|
||||
|
||||
tmp = g_key_file_get_string(config, section, key, &error);
|
||||
if (G_UNLIKELY(error))
|
||||
tmp = g_key_file_get_string(config, section, key, NULL);
|
||||
if (G_UNLIKELY(!tmp))
|
||||
{
|
||||
g_error_free(error);
|
||||
return g_strdup(default_value);
|
||||
}
|
||||
return tmp;
|
||||
|
Loading…
x
Reference in New Issue
Block a user