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:
Nick Treleaven 2009-10-19 15:19:09 +00:00
parent 7c450e2939
commit e9547d1664

View File

@ -806,15 +806,13 @@ gchar *utils_get_setting_string(GKeyFile *config, const gchar *section, const gc
const gchar *default_value) const gchar *default_value)
{ {
gchar *tmp; gchar *tmp;
GError *error = NULL;
if (G_UNLIKELY(config == NULL)) if (G_UNLIKELY(config == NULL))
return g_strdup(default_value); return g_strdup(default_value);
tmp = g_key_file_get_string(config, section, key, &error); tmp = g_key_file_get_string(config, section, key, NULL);
if (G_UNLIKELY(error)) if (G_UNLIKELY(!tmp))
{ {
g_error_free(error);
return g_strdup(default_value); return g_strdup(default_value);
} }
return tmp; return tmp;