Bug 627575 - Stylesheet names with non-alphanumeric characters and saved-reports -- addendum

Work around a bug in guile 1.8. It escapes spaces in symbols
when printed to a string, but can't convert that string
back properly in a symbol

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23501 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2013-12-07 15:57:46 +00:00
parent f14bd73ba9
commit a0ca453e6c

View File

@ -269,12 +269,33 @@ gchar *gnc_scm_strip_comments (SCM scm_text)
splits = g_strsplit(raw_text, "\n", -1);
for (i = j = 0; splits[i]; i++)
{
gchar *haystack, *needle;
if ((splits[i][0] == ';') || (splits[i][0] == '\0'))
{
g_free(splits[i]);
continue;
}
splits[j++] = g_strstrip(splits[i]);
/* Work around a bug in guile 1.8 that escapes spaces
* in a symbol printed on a string port. We don't
* want this, because this string can't be properly
* converted back into a symbol later on. */
haystack = splits [i];
needle = g_strstr_len (haystack, -1, "\\ ");
while (needle)
{
gchar *new_haystack = NULL;
gsize prefix_size = needle - haystack;
gchar *prefix = g_strndup (haystack, prefix_size);
needle++;
new_haystack = g_strconcat (prefix, needle, NULL);
g_free (prefix);
g_free (haystack);
haystack = new_haystack;
needle = g_strstr_len (haystack, -1, "\\ ");
}
splits[j++] = haystack;
}
splits[j] = NULL;