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));
|
str = gnc_scm_to_utf8_string (SCM_CAR(list));
|
||||||
if (str)
|
if (str)
|
||||||
glist = g_list_prepend (glist, g_strdup (str));
|
glist = g_list_prepend (glist, str);
|
||||||
g_free (str);
|
|
||||||
}
|
}
|
||||||
list = SCM_CDR (list);
|
list = SCM_CDR (list);
|
||||||
}
|
}
|
||||||
@@ -186,8 +185,7 @@ gnc_scm_to_gslist_string(SCM list)
|
|||||||
|
|
||||||
str = gnc_scm_to_utf8_string (SCM_CAR(list));
|
str = gnc_scm_to_utf8_string (SCM_CAR(list));
|
||||||
if (str)
|
if (str)
|
||||||
gslist = g_slist_prepend (gslist, g_strdup (str));
|
gslist = g_slist_prepend (gslist, str);
|
||||||
g_free (str);
|
|
||||||
}
|
}
|
||||||
list = SCM_CDR (list);
|
list = SCM_CDR (list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,15 +39,7 @@
|
|||||||
gchar *gnc_scm_to_utf8_string(SCM scm_string)
|
gchar *gnc_scm_to_utf8_string(SCM scm_string)
|
||||||
{
|
{
|
||||||
if (scm_is_string (scm_string))
|
if (scm_is_string (scm_string))
|
||||||
{
|
return scm_to_utf8_stringn(scm_string, NULL);
|
||||||
gchar* s;
|
|
||||||
char * str;
|
|
||||||
|
|
||||||
str = scm_to_utf8_stringn(scm_string, NULL);
|
|
||||||
s = g_strdup(str);
|
|
||||||
free (str);
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Unable to extract string from the symbol...*/
|
/* Unable to extract string from the symbol...*/
|
||||||
g_error ("bad value\n");
|
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)
|
gchar *gnc_scm_to_locale_string(SCM scm_string)
|
||||||
{
|
{
|
||||||
if (scm_is_string (scm_string))
|
if (scm_is_string (scm_string))
|
||||||
{
|
return scm_to_locale_string(scm_string);
|
||||||
gchar* s;
|
|
||||||
char * str;
|
|
||||||
|
|
||||||
str = scm_to_locale_string(scm_string);
|
|
||||||
s = g_strdup(str);
|
|
||||||
free (str);
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Unable to extract string from the symbol...*/
|
/* Unable to extract string from the symbol...*/
|
||||||
g_error ("bad value\n");
|
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);
|
SCM string_value = scm_symbol_to_string (symbol_value);
|
||||||
if (scm_is_string (string_value))
|
if (scm_is_string (string_value))
|
||||||
{
|
return scm_to_utf8_string (string_value);
|
||||||
char *tmp = scm_to_utf8_string (string_value);
|
|
||||||
gchar *str = g_strdup (tmp);
|
|
||||||
free (tmp);
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unable to extract string from the symbol...*/
|
/* Unable to extract string from the symbol...*/
|
||||||
|
|||||||
Reference in New Issue
Block a user