mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Don't g_strdup char* from scm_to_locale|utf8_string
Both scm_to_locale_string and scm_to_utf8_string return newly allocated char*. It is not necessary to return a strdup'd char* and free the original.
This commit is contained in:
@@ -164,8 +164,7 @@ gnc_scm_to_glist_string(SCM list)
|
||||
|
||||
str = gnc_scm_to_utf8_string (SCM_CAR(list));
|
||||
if (str)
|
||||
glist = g_list_prepend (glist, g_strdup (str));
|
||||
g_free (str);
|
||||
glist = g_list_prepend (glist, str);
|
||||
}
|
||||
list = SCM_CDR (list);
|
||||
}
|
||||
@@ -186,8 +185,7 @@ gnc_scm_to_gslist_string(SCM list)
|
||||
|
||||
str = gnc_scm_to_utf8_string (SCM_CAR(list));
|
||||
if (str)
|
||||
gslist = g_slist_prepend (gslist, g_strdup (str));
|
||||
g_free (str);
|
||||
gslist = g_slist_prepend (gslist, str);
|
||||
}
|
||||
list = SCM_CDR (list);
|
||||
}
|
||||
|
||||
@@ -39,15 +39,7 @@
|
||||
gchar *gnc_scm_to_utf8_string(SCM scm_string)
|
||||
{
|
||||
if (scm_is_string (scm_string))
|
||||
{
|
||||
gchar* s;
|
||||
char * str;
|
||||
|
||||
str = scm_to_utf8_stringn(scm_string, NULL);
|
||||
s = g_strdup(str);
|
||||
free (str);
|
||||
return s;
|
||||
}
|
||||
return scm_to_utf8_stringn(scm_string, NULL);
|
||||
|
||||
/* Unable to extract string from the symbol...*/
|
||||
g_error ("bad value\n");
|
||||
@@ -71,15 +63,7 @@ gchar *gnc_scm_to_utf8_string(SCM scm_string)
|
||||
gchar *gnc_scm_to_locale_string(SCM scm_string)
|
||||
{
|
||||
if (scm_is_string (scm_string))
|
||||
{
|
||||
gchar* s;
|
||||
char * str;
|
||||
|
||||
str = scm_to_locale_string(scm_string);
|
||||
s = g_strdup(str);
|
||||
free (str);
|
||||
return s;
|
||||
}
|
||||
return scm_to_locale_string(scm_string);
|
||||
|
||||
/* Unable to extract string from the symbol...*/
|
||||
g_error ("bad value\n");
|
||||
@@ -104,12 +88,7 @@ gnc_scm_symbol_to_locale_string(SCM symbol_value)
|
||||
{
|
||||
SCM string_value = scm_symbol_to_string (symbol_value);
|
||||
if (scm_is_string (string_value))
|
||||
{
|
||||
char *tmp = scm_to_utf8_string (string_value);
|
||||
gchar *str = g_strdup (tmp);
|
||||
free (tmp);
|
||||
return str;
|
||||
}
|
||||
return scm_to_utf8_string (string_value);
|
||||
}
|
||||
|
||||
/* Unable to extract string from the symbol...*/
|
||||
|
||||
Reference in New Issue
Block a user