use g_strdup -- cannot feed SCM_STRING_CHARS() back into guile.

(fixes a weird test-case failure in some cases).



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13122 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2006-02-05 19:58:20 +00:00
parent 78855e5370
commit 5a9af7ef30
2 changed files with 11 additions and 4 deletions

View File

@ -2,6 +2,10 @@
* src/backend/file/test/Makefile.am: link against libcore-utils.
* src/app-utils/test/test-scm-query-string.c:
use g_strdup -- cannot feed SCM_STRING_CHARS() back into guile.
(fixes a weird test-case failure in some cases).
2006-02-05 Neil Williams <linux@codehelp.co.uk>
* lib/libqof/qof/qoflog.c :

View File

@ -20,6 +20,7 @@ test_query (Query *q, SCM val2str)
SCM args = SCM_EOL;
Query *q2;
const gchar * str;
gchar *str2 = NULL;
scm_q = gnc_query2scm (q);
args = scm_cons (scm_q, SCM_EOL);
@ -29,9 +30,9 @@ test_query (Query *q, SCM val2str)
str_q = scm_string_append (args);
str = SCM_STRING_CHARS (str_q);
if (str) {
res_q = scm_c_eval_string (str);
if (str) str2 = g_strdup(str);
if (str2) {
res_q = scm_c_eval_string (str2);
} else {
res_q = SCM_BOOL_F;
}
@ -41,16 +42,18 @@ test_query (Query *q, SCM val2str)
if (!xaccQueryEqual (q, q2))
{
failure ("queries don't match");
fprintf (stderr, "%s\n\n", str ? str : "(null)");
fprintf (stderr, "%s\n\n", str2 ? str2 : "(null)");
scm_q = gnc_query2scm (q2);
scm_display (scm_q, SCM_UNDEFINED);
scm_newline (SCM_UNDEFINED);
if (str2) g_free(str2);
exit (1);
}
else
{
success ("queries match");
}
if (str2) g_free(str2);
if (q2) xaccFreeQuery (q2);
}