r22651 - gnucash/trunk/src - Guile 2: replace deprecated SCM_SYMBOL_CHARS function

Geert Janssens gjanssens at code.gnucash.org
Sat Dec 15 12:58:40 EST 2012


Author: gjanssens
Date: 2012-12-15 12:58:40 -0500 (Sat, 15 Dec 2012)
New Revision: 22651
Trac: http://svn.gnucash.org/trac/changeset/22651

Added:
   gnucash/trunk/src/core-utils/gnc-guile-utils.c
   gnucash/trunk/src/core-utils/gnc-guile-utils.h
Modified:
   gnucash/trunk/src/app-utils/guile-util.c
   gnucash/trunk/src/app-utils/guile-util.h
   gnucash/trunk/src/app-utils/option-util.c
   gnucash/trunk/src/core-utils/Makefile.am
   gnucash/trunk/src/engine/engine-helpers.c
   gnucash/trunk/src/gnome/dialog-tax-info.c
   gnucash/trunk/src/import-export/qif-import/assistant-qif-import.c
Log:
Guile 2: replace deprecated SCM_SYMBOL_CHARS function

The replacements require guile 1.8 or above

Modified: gnucash/trunk/src/app-utils/guile-util.c
===================================================================
--- gnucash/trunk/src/app-utils/guile-util.c	2012-12-15 17:58:27 UTC (rev 22650)
+++ gnucash/trunk/src/app-utils/guile-util.c	2012-12-15 17:58:40 UTC (rev 22651)
@@ -41,6 +41,7 @@
 #include "glib-helpers.h"
 #include "gnc-gconf-utils.h"
 #include "gnc-glib-utils.h"
+#include "gnc-guile-utils.h"
 #include "guile-util.h"
 #include "guile-mappings.h"
 
@@ -163,7 +164,7 @@
 
         if (scm_is_string(value))
         {
-            return gnc_scm_to_locale_string(value);
+            return scm_to_locale_string(value);
         }
         else
         {
@@ -192,18 +193,12 @@
 char *
 gnc_guile_call1_symbol_to_string(SCM func, SCM arg)
 {
-    SCM value;
+    SCM symbol_value;
 
     if (scm_is_procedure(func))
     {
-        value = scm_call_1(func, arg);
-
-        if (scm_is_symbol(value))
-            return g_strdup(SCM_SYMBOL_CHARS(value));
-        else
-        {
-            PERR("bad value\n");
-        }
+        symbol_value = scm_call_1(func, arg);
+        return gnc_scm_symbol_to_locale_string (symbol_value);
     }
     else
     {
@@ -662,7 +657,7 @@
     if (!scm_is_string(result))
         return NULL;
 
-    return gnc_scm_to_locale_string(result);
+    return scm_to_locale_string(result);
 }
 
 
@@ -687,7 +682,7 @@
     if (!scm_is_string(result))
         return NULL;
 
-    return gnc_scm_to_locale_string(result);
+    return scm_to_locale_string(result);
 }
 
 
@@ -1116,7 +1111,7 @@
     if (!scm_is_string(result))
         return NULL;
 
-    return gnc_scm_to_locale_string(result);
+    return scm_to_locale_string(result);
 }
 
 
@@ -1147,7 +1142,7 @@
     if (!scm_is_string(result))
         return NULL;
 
-    return gnc_scm_to_locale_string(result);
+    return scm_to_locale_string(result);
 }
 
 
@@ -1316,18 +1311,3 @@
 
     return gnc_mktime(&tm);
 }
-
-gchar *gnc_scm_to_locale_string(SCM scm_string)
-{
-    gchar* s;
-    char * str;
-
-    scm_dynwind_begin (0);
-    str = scm_to_locale_string(scm_string);
-
-    /* prevent memory leaks in scm_to_locale_string() per guile manual; see 'http://www.gnu.org/software/guile/manual/html_node/Dynamic-Wind.html#Dynamic-Wind' */
-    s = g_strdup(str);
-    scm_dynwind_free (str);
-    scm_dynwind_end ();
-    return s;
-}

Modified: gnucash/trunk/src/app-utils/guile-util.h
===================================================================
--- gnucash/trunk/src/app-utils/guile-util.h	2012-12-15 17:58:27 UTC (rev 22650)
+++ gnucash/trunk/src/app-utils/guile-util.h	2012-12-15 17:58:40 UTC (rev 22651)
@@ -29,6 +29,7 @@
 
 #include "qof.h"
 #include "Account.h"
+#include "gnc-guile-utils.h"
 
 
 /* Helpful functions for calling functions that return
@@ -41,11 +42,6 @@
 SCM    gnc_guile_list_ref(SCM list, int index);
 SCM    gnc_guile_call1_to_vector(SCM func, SCM arg);
 
-/** Wrapper around scm_to_locale_string() that returns a newly
- * allocated string (even for guile-1.6 version). The caller must
- * g_free() the returned string later. */
-gchar * gnc_scm_to_locale_string(SCM scm_string);
-
 /* Don't use this to get hold of symbols that are considered private
  * to a given module unless the C code you're writing is considered
  * part of that module.  */

Modified: gnucash/trunk/src/app-utils/option-util.c
===================================================================
--- gnucash/trunk/src/app-utils/option-util.c	2012-12-15 17:58:27 UTC (rev 22650)
+++ gnucash/trunk/src/app-utils/option-util.c	2012-12-15 17:58:40 UTC (rev 22651)
@@ -2102,7 +2102,7 @@
         {
             value = scm_call_0(getter);
             if (scm_is_symbol(value))
-                return g_strdup(SCM_SYMBOL_CHARS(value));
+                return gnc_scm_symbol_to_locale_string (value);
         }
     }
 
@@ -2196,7 +2196,7 @@
                         *is_relative = TRUE;
 
                     if (set_rel_value != NULL)
-                        *set_rel_value = g_strdup(SCM_SYMBOL_CHARS (relative));
+                        *set_rel_value = gnc_scm_symbol_to_locale_string (relative);
                 }
 
                 g_free (symbol);
@@ -2356,7 +2356,7 @@
             return default_value;
         }
 
-        list = g_slist_prepend(list, g_strdup(SCM_SYMBOL_CHARS(item)));
+        list = g_slist_prepend(list, gnc_scm_symbol_to_locale_string (item));
     }
 
     if (!scm_is_list(value) || !scm_is_null(value))
@@ -2615,12 +2615,7 @@
 
     initialize_getters();
 
-    value = scm_call_1(getters.date_option_subtype, option->guile_option);
-
-    if (scm_is_symbol(value))
-        return g_strdup(SCM_SYMBOL_CHARS(value));
-    else
-        return NULL;
+    return gnc_guile_call1_symbol_to_string(getters.date_option_subtype, option->guile_option);
 }
 
 /*******************************************************************\
@@ -2637,11 +2632,7 @@
 
     initialize_getters();
 
-    value = scm_call_1 (getters.date_option_value_type, option_value);
-    if (!scm_is_symbol (value))
-        return NULL;
-
-    return g_strdup(SCM_SYMBOL_CHARS (value));
+    return gnc_guile_call1_symbol_to_string (getters.date_option_value_type, option_value);
 }
 
 /*******************************************************************\
@@ -2717,7 +2708,7 @@
         gboolean *years, char **custom)
 {
     SCM val;
-    const char *str;
+    gchar *str;
 
     if (!scm_is_list(value) || scm_is_null(value))
         return TRUE;
@@ -2730,7 +2721,7 @@
         value = SCM_CDR(value);
         if (!scm_is_symbol(val))
             break;
-        str = SCM_SYMBOL_CHARS (val);
+        str = gnc_scm_symbol_to_locale_string  (val);
         if (!str)
             break;
 
@@ -2738,16 +2729,18 @@
         {
             if (gnc_date_string_to_dateformat(str, format))
             {
+                g_free (str);
                 break;
             }
         }
+        g_free (str);
 
         /* parse the months */
         val = SCM_CAR(value);
         value = SCM_CDR(value);
         if (!scm_is_symbol(val))
             break;
-        str = SCM_SYMBOL_CHARS (val);
+        str = gnc_scm_symbol_to_locale_string (val);
         if (!str)
             break;
 
@@ -2755,9 +2748,11 @@
         {
             if (gnc_date_string_to_monthformat(str, months))
             {
+                g_free (str);
                 break;
             }
         }
+        g_free (str);
 
         /* parse the years */
         val = SCM_CAR(value);
@@ -2780,11 +2775,9 @@
         {
             char * tmp_str;
             char * string;
-            scm_dynwind_begin (0);
             tmp_str = scm_to_locale_string (val);
             string = g_strdup (tmp_str);
-            scm_dynwind_free (tmp_str);
-            scm_dynwind_end ();
+            free (tmp_str);
             *custom = string;
         }
 

Modified: gnucash/trunk/src/core-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/core-utils/Makefile.am	2012-12-15 17:58:27 UTC (rev 22650)
+++ gnucash/trunk/src/core-utils/Makefile.am	2012-12-15 17:58:40 UTC (rev 22651)
@@ -10,6 +10,7 @@
   gnc-gdate-utils.c \
   gnc-gkeyfile-utils.c \
   gnc-glib-utils.c \
+  gnc-guile-utils.c \
   gnc-jalali.c \
   gnc-locale-utils.c \
   gnc-main.c \
@@ -35,6 +36,7 @@
   gnc-gdate-utils.h \
   gnc-gkeyfile-utils.h \
   gnc-glib-utils.h \
+  gnc-guile-utils.h \
   gnc-jalali.h \
   gnc-locale-utils.h \
   gnc-path.h \

Added: gnucash/trunk/src/core-utils/gnc-guile-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-guile-utils.c	                        (rev 0)
+++ gnucash/trunk/src/core-utils/gnc-guile-utils.c	2012-12-15 17:58:40 UTC (rev 22651)
@@ -0,0 +1,62 @@
+/********************************************************************\
+ * gnc-guile-utils.c -- basic guile extensions                      *
+ * Copyright (C) 2012 Geert Janssens                                *
+ *                                                                  *
+ * This program is free software; you can redistribute it and/or    *
+ * modify it under the terms of the GNU General Public License as   *
+ * published by the Free Software Foundation; either version 2 of   *
+ * the License, or (at your option) any later version.              *
+ *                                                                  *
+ * This program is distributed in the hope that it will be useful,  *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
+ * GNU General Public License for more details.                     *
+ *                                                                  *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, write to the Free Software      *
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.        *
+\********************************************************************/
+
+#include "config.h"
+
+#include <glib.h>
+#include "swig-runtime.h"
+#include <libguile.h>
+
+#include "qof.h"
+#include "gnc-guile-utils.h"
+#include "guile-mappings.h"
+
+/* This static indicates the debugging module this .o belongs to.  */
+static QofLogModule log_module = G_LOG_DOMAIN;
+
+
+/********************************************************************\
+ * gnc_guile_symbol_to_locale_string                                *
+ *   returns the string representation of the scm symbol in         *
+ *   a newly allocated gchar * or NULL if it can't be retrieved.    *
+ *                                                                  *
+ * Args: symbol_value - the scm symbol                              *
+ * Returns: newly allocated gchar * or NULL, should be freed with   *
+ *          g_free by the caller                                    *
+\********************************************************************/
+gchar *
+gnc_scm_symbol_to_locale_string(SCM symbol_value)
+{
+
+    if (scm_is_symbol(symbol_value))
+    {
+        SCM string_value = scm_symbol_to_string (symbol_value);
+        if (scm_is_string (string_value))
+        {
+            char  *tmp = scm_to_locale_string (string_value);
+            gchar *str = g_strdup (tmp);
+            free (tmp);
+            return str;
+        }
+    }
+
+    /* Unable to extract string from the symbol...*/
+    PERR("bad value\n");
+    return NULL;
+}

Added: gnucash/trunk/src/core-utils/gnc-guile-utils.h
===================================================================
--- gnucash/trunk/src/core-utils/gnc-guile-utils.h	                        (rev 0)
+++ gnucash/trunk/src/core-utils/gnc-guile-utils.h	2012-12-15 17:58:40 UTC (rev 22651)
@@ -0,0 +1,34 @@
+/********************************************************************\
+ * gnc-guile-utils.h -- basic guile extensions                      *
+ * Copyright (C) 2012 Geert Janssens                                *
+ *                                                                  *
+ * This program is free software; you can redistribute it and/or    *
+ * modify it under the terms of the GNU General Public License as   *
+ * published by the Free Software Foundation; either version 2 of   *
+ * the License, or (at your option) any later version.              *
+ *                                                                  *
+ * This program is distributed in the hope that it will be useful,  *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
+ * GNU General Public License for more details.                     *
+ *                                                                  *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#ifndef GNC_GUILE_UTILS_H
+#define GNC_GUILE_UTILS_H
+
+#include <glib.h>
+#include <libguile.h>
+
+/** Helper function to get the string representation of
+ *  a guile symbol. */
+gchar * gnc_scm_symbol_to_locale_string(SCM scm_string);
+
+#endif

Modified: gnucash/trunk/src/engine/engine-helpers.c
===================================================================
--- gnucash/trunk/src/engine/engine-helpers.c	2012-12-15 17:58:27 UTC (rev 22650)
+++ gnucash/trunk/src/engine/engine-helpers.c	2012-12-15 17:58:40 UTC (rev 22651)
@@ -34,6 +34,7 @@
 #include "gnc-date.h"
 #include "gnc-engine.h"
 #include "guile-mappings.h"
+#include "gnc-guile-utils.h"
 #include "qof.h"
 /** \todo Code dependent on the private query headers
 qofquery-p.h and qofquerycore-p.h may need to be modified.
@@ -248,7 +249,7 @@
 gnc_scm2acct_match_how (SCM how_scm)
 {
     QofGuidMatch res;
-    const gchar *how = SCM_SYMBOL_CHARS (how_scm);
+    gchar *how = gnc_scm_symbol_to_locale_string (how_scm);
 
     if (!g_strcmp0 (how, "acct-match-all"))
         res = QOF_GUID_MATCH_ALL;
@@ -261,6 +262,8 @@
         PINFO ("invalid account match: %s", how);
         res = QOF_GUID_MATCH_NULL;
     }
+
+    g_free (how);
     return res;
 }
 
@@ -268,7 +271,7 @@
 gnc_scm2amt_match_how (SCM how_scm)
 {
     QofQueryCompare res;
-    const gchar *how = SCM_SYMBOL_CHARS (how_scm);
+    gchar *how = gnc_scm_symbol_to_locale_string (how_scm);
 
     if (!g_strcmp0 (how, "amt-match-atleast"))
         res = QOF_COMPARE_GTE;
@@ -282,6 +285,7 @@
         res = QOF_COMPARE_EQUAL;
     }
 
+    g_free (how);
     return res;
 }
 
@@ -289,7 +293,7 @@
 gnc_scm2kvp_match_how (SCM how_scm)
 {
     QofQueryCompare res;
-    const gchar *how = SCM_SYMBOL_CHARS (how_scm);
+    gchar *how = gnc_scm_symbol_to_locale_string (how_scm);
 
     if (!g_strcmp0 (how, "kvp-match-lt"))
         res = QOF_COMPARE_LT;
@@ -306,6 +310,8 @@
         PINFO ("invalid kvp match: %s", how);
         res = QOF_COMPARE_EQUAL;
     }
+
+    g_free (how);
     return res;
 }
 
@@ -341,7 +347,7 @@
 static gboolean
 gnc_scm2balance_match_how (SCM how_scm, gboolean *resp)
 {
-    const gchar *how;
+    gchar *how;
 
     if (!scm_is_list (how_scm))
         return FALSE;
@@ -353,13 +359,14 @@
     if (!scm_is_null (SCM_CDR (how_scm)))
         return FALSE;
 
-    how = SCM_SYMBOL_CHARS (SCM_CAR(how_scm));
+    how = gnc_scm_symbol_to_locale_string (SCM_CAR(how_scm));
 
     if (!g_strcmp0 (how, "balance-match-balanced"))
         *resp = TRUE;
     else
         *resp = FALSE;
 
+    g_free (how);
     return TRUE;
 }
 
@@ -367,12 +374,12 @@
 gnc_scm2kvp_match_where (SCM where_scm)
 {
     QofIdType res;
-    const gchar *where;
+    gchar *where;
 
     if (!scm_is_list (where_scm))
         return NULL;
 
-    where = SCM_SYMBOL_CHARS (SCM_CAR(where_scm));
+    where = gnc_scm_symbol_to_locale_string (SCM_CAR(where_scm));
 
     if (!g_strcmp0 (where, "kvp-match-split"))
         res = GNC_ID_SPLIT;
@@ -385,6 +392,8 @@
         PINFO ("Unknown kvp-match-where: %s", where);
         res = NULL;
     }
+
+    g_free (where);
     return res;
 }
 
@@ -914,7 +923,7 @@
     QofQuery *q = NULL;
     QofQueryPredData *pd = NULL;
     SCM scm;
-    const gchar *type = NULL;
+    gchar *type = NULL;
     GSList *path = NULL;
     gboolean inverted = FALSE;
     QofQueryCompare compare_how;
@@ -943,7 +952,7 @@
         qt_scm = SCM_CDR (qt_scm);
         if (!scm_is_symbol (scm))
             break;
-        type = SCM_SYMBOL_CHARS (scm);
+        type = gnc_scm_symbol_to_locale_string (scm);
 
         /* QofCompareFunc */
         scm = SCM_CAR (qt_scm);
@@ -1136,6 +1145,8 @@
             break;
         }
 
+        g_free (type);
+
     }
     while (FALSE);
 
@@ -1162,8 +1173,8 @@
 gnc_scm2query_term_query_v1 (SCM query_term_scm)
 {
     gboolean ok = FALSE;
-    const gchar * pd_type = NULL;
-    const gchar * pr_type = NULL;
+    gchar * pd_type = NULL;
+    gchar * pr_type = NULL;
     gboolean sense = FALSE;
     QofQuery *q = NULL;
     SCM scm;
@@ -1180,7 +1191,7 @@
         /* pd_type */
         scm = SCM_CAR (query_term_scm);
         query_term_scm = SCM_CDR (query_term_scm);
-        pd_type = SCM_SYMBOL_CHARS (scm);
+        pd_type = gnc_scm_symbol_to_locale_string (scm);
 
         /* pr_type */
         if (scm_is_null (query_term_scm))
@@ -1190,7 +1201,7 @@
         }
         scm = SCM_CAR (query_term_scm);
         query_term_scm = SCM_CDR (query_term_scm);
-        pr_type = SCM_SYMBOL_CHARS (scm);
+        pr_type = gnc_scm_symbol_to_locale_string (scm);
 
         /* sense */
         if (scm_is_null (query_term_scm))
@@ -1516,6 +1527,9 @@
             PINFO ("Unknown Predicate: %s", pd_type);
         }
 
+        g_free (pd_type);
+        g_free (pr_type);
+
     }
     while (FALSE);
 
@@ -1884,9 +1898,9 @@
 {
     QofQuery *q = NULL;
     gboolean ok = TRUE;
-    const gchar * primary_sort = NULL;
-    const gchar * secondary_sort = NULL;
-    const gchar * tertiary_sort = NULL;
+    gchar * primary_sort = NULL;
+    gchar * secondary_sort = NULL;
+    gchar * tertiary_sort = NULL;
     gboolean primary_increasing = TRUE;
     gboolean secondary_increasing = TRUE;
     gboolean tertiary_increasing = TRUE;
@@ -1894,7 +1908,7 @@
 
     while (!scm_is_null (query_scm))
     {
-        const gchar *symbol;
+        gchar *symbol;
         SCM sym_scm;
         SCM value;
         SCM pair;
@@ -1919,7 +1933,7 @@
             break;
         }
 
-        symbol = SCM_SYMBOL_CHARS (sym_scm);
+        symbol = gnc_scm_symbol_to_locale_string (sym_scm);
         if (!symbol)
         {
             PERR ("No string found");
@@ -1950,7 +1964,7 @@
                 break;
             }
 
-            primary_sort = SCM_SYMBOL_CHARS (value);
+            primary_sort = gnc_scm_symbol_to_locale_string (value);
 
         }
         else if (g_strcmp0 ("secondary-sort", symbol) == 0)
@@ -1962,7 +1976,7 @@
                 break;
             }
 
-            secondary_sort = SCM_SYMBOL_CHARS (value);
+            secondary_sort = gnc_scm_symbol_to_locale_string (value);
 
         }
         else if (g_strcmp0 ("tertiary-sort", symbol) == 0)
@@ -1974,7 +1988,7 @@
                 break;
             }
 
-            tertiary_sort = SCM_SYMBOL_CHARS (value);
+            tertiary_sort = gnc_scm_symbol_to_locale_string (value);
 
         }
         else if (g_strcmp0 ("primary-increasing", symbol) == 0)
@@ -2010,6 +2024,8 @@
             ok = FALSE;
             break;
         }
+
+        g_free (symbol);
     }
 
     if (ok)
@@ -2023,12 +2039,18 @@
         qof_query_set_sort_increasing (q, primary_increasing, secondary_increasing,
                                        tertiary_increasing);
         qof_query_set_max_results (q, max_splits);
-
-        return q;
     }
+    else
+    {
+        qof_query_destroy (q);
+        q = NULL;
+    }
 
-    qof_query_destroy (q);
-    return NULL;
+    g_free (primary_sort);
+    g_free (secondary_sort);
+    g_free (tertiary_sort);
+
+    return q;
 }
 
 static QofQuery *
@@ -2036,7 +2058,7 @@
 {
     QofQuery *q = NULL;
     gboolean ok = TRUE;
-    const gchar * search_for = NULL;
+    gchar * search_for = NULL;
     GSList *sp1 = NULL, *sp2 = NULL, *sp3 = NULL;
     gint so1 = 0, so2 = 0, so3 = 0;
     gboolean si1 = TRUE, si2 = TRUE, si3 = TRUE;
@@ -2044,7 +2066,7 @@
 
     while (!scm_is_null (query_scm))
     {
-        const gchar *symbol;
+        gchar *symbol;
         SCM sym_scm;
         SCM value;
         SCM pair;
@@ -2067,7 +2089,7 @@
             break;
         }
 
-        symbol = SCM_SYMBOL_CHARS (sym_scm);
+        symbol = gnc_scm_symbol_to_locale_string (sym_scm);
         if (!symbol)
         {
             ok = FALSE;
@@ -2094,7 +2116,7 @@
                 ok = FALSE;
                 break;
             }
-            search_for = SCM_SYMBOL_CHARS (value);
+            search_for = gnc_scm_symbol_to_locale_string (value);
 
         }
         else if (g_strcmp0 ("primary-sort", symbol) == 0)
@@ -2140,6 +2162,8 @@
             ok = FALSE;
             break;
         }
+
+        g_free (symbol);
     }
 
     if (ok && search_for)
@@ -2149,19 +2173,23 @@
         qof_query_set_sort_options (q, so1, so2, so3);
         qof_query_set_sort_increasing (q, si1, si2, si3);
         qof_query_set_max_results (q, max_results);
-
-        return q;
     }
+    else
+    {
+        qof_query_destroy (q);
+        q = NULL;
+    }
 
-    qof_query_destroy (q);
-    return NULL;
+    g_free (search_for);
+
+    return q;
 }
 
 QofQuery *
 gnc_scm2query (SCM query_scm)
 {
     SCM q_type;
-    const gchar *type;
+    gchar *type;
     QofQuery *q = NULL;
 
     /* Not a list or NULL?  No need to go further */
@@ -2185,13 +2213,14 @@
     }
 
     /* Ok, the LHS is the version and the RHS is the actual query list */
-    type = SCM_SYMBOL_CHARS (q_type);
+    type = gnc_scm_symbol_to_locale_string (q_type);
     if (!type)
         return NULL;
 
     if (!g_strcmp0 (type, "query-v2"))
         q = gnc_scm2query_v2 (SCM_CDR (query_scm));
 
+    g_free (type);
     return q;
 }
 

Modified: gnucash/trunk/src/gnome/dialog-tax-info.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-tax-info.c	2012-12-15 17:58:27 UTC (rev 22650)
+++ gnucash/trunk/src/gnome/dialog-tax-info.c	2012-12-15 17:58:40 UTC (rev 22651)
@@ -30,6 +30,7 @@
 #include <glib/gi18n.h>
 #include <libguile.h>
 #include "guile-mappings.h"
+#include "guile-util.h"
 
 #include "Account.h"
 #include "gnc-ui-util.h"
@@ -299,7 +300,7 @@
         scm = scm_call_3 (getters.payer_name_source, category, code_scm,
                           tax_entity_type);
         if (scm_is_symbol(scm))
-            str = g_strdup (SCM_SYMBOL_CHARS (scm));
+            str = gnc_scm_symbol_to_locale_string (scm);
         else
             str = g_strdup ("");
         if (g_strcmp0 (str, "not-impl") == 0)
@@ -317,7 +318,7 @@
         g_free (str);
 
         if (scm_is_symbol(code_scm))
-            str = g_strdup (SCM_SYMBOL_CHARS (code_scm));
+            str = gnc_scm_symbol_to_locale_string (code_scm);
         else
             str = g_strdup ("");
         txf_info->code = g_strdup (str);
@@ -504,7 +505,7 @@
         tax_type_info = g_new0 (TaxTypeInfo, 1);
 
         if (scm_is_symbol(type_scm))
-            str = g_strdup (SCM_SYMBOL_CHARS (type_scm));
+            str = gnc_scm_symbol_to_locale_string (type_scm);
         else
             str = g_strdup ("");
         tax_type_info->type_code = g_strdup (str);

Modified: gnucash/trunk/src/import-export/qif-import/assistant-qif-import.c
===================================================================
--- gnucash/trunk/src/import-export/qif-import/assistant-qif-import.c	2012-12-15 17:58:27 UTC (rev 22650)
+++ gnucash/trunk/src/import-export/qif-import/assistant-qif-import.c	2012-12-15 17:58:40 UTC (rev 22651)
@@ -53,6 +53,7 @@
 #include "gnc-plugin-page-account-tree.h"
 #include "gnc-ui.h"
 #include "guile-mappings.h"
+#include "guile-util.h"
 
 #include "swig-runtime.h"
 
@@ -1910,7 +1911,7 @@
                 while (scm_is_list(date_formats) && !scm_is_null(date_formats))
                 {
                     gtk_list_store_append(GTK_LIST_STORE(model), &iter);
-                    gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, SCM_SYMBOL_CHARS(SCM_CAR(date_formats)), -1);
+                    gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, gnc_scm_symbol_to_locale_string(SCM_CAR(date_formats)), -1);
 
                     date_formats = SCM_CDR(date_formats);
                 }



More information about the gnucash-changes mailing list