gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Sat Oct 16 11:04:52 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/171ce941 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/19a91f04 (commit)
	from  https://github.com/Gnucash/gnucash/commit/d4e4062c (commit)



commit 171ce9413b6ae73bc1f2129add146d73975c6145
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Oct 16 22:50:09 2021 +0800

    Don't g_strdup char* returned by scm_to_locale_string
    
    Previous code was returning a duplicated string and released the
    original one. It's no better than returning the original returned
    char* instead.

diff --git a/bindings/engine.i b/bindings/engine.i
index a8fe5827d..6edd61abc 100644
--- a/bindings/engine.i
+++ b/bindings/engine.i
@@ -243,16 +243,11 @@ time64 time64CanonicalDayTime(time64 t);
   {
     SCM key_scm = SCM_CAR (path_scm);
     char *key;
-    gchar* gkey;
-
     if (!scm_is_string (key_scm))
       break;
 
     key = scm_to_locale_string (key_scm);
-    gkey = g_strdup (key);
-    free (key);
-
-    path = g_list_prepend (path, gkey);
+    path = g_list_prepend (path, key);
 
     path_scm = SCM_CDR (path_scm);
   }
@@ -462,13 +457,10 @@ void qof_book_set_string_option(QofBook* book, const char* opt_name, const char*
     {
         SCM key_scm = SCM_CAR (path_scm);
         char *key;
-        gchar* gkey;
         if (!scm_is_string (key_scm))
             break;
         key = scm_to_locale_string (key_scm);
-        gkey = g_strdup (key);
-        free (key);
-        path = g_list_prepend (path, gkey);
+        path = g_list_prepend (path, key);
         path_scm = SCM_CDR (path_scm);
     }
     $1 = g_list_reverse (path);

commit 19a91f041e0df59a2cfc043dad5b203ca0f6784d
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Oct 16 22:42:24 2021 +0800

    Revert "g_list_free swigged GList* arguments"
    
    This reverts commit 16184daf9573bef0a1892985747711f890a39eed. Was
    causing an unexplained GNC_IS_ACCOUNT assertion failure in
    account_foreach_descendant.

diff --git a/bindings/engine.i b/bindings/engine.i
index bdc9057f3..a8fe5827d 100644
--- a/bindings/engine.i
+++ b/bindings/engine.i
@@ -67,6 +67,7 @@ GLIST_HELPER_INOUT(TransList, SWIGTYPE_p_Transaction);
 GLIST_HELPER_INOUT(LotList, SWIGTYPE_p_GNCLot);
 GLIST_HELPER_INOUT(AccountList, SWIGTYPE_p_Account);
 GLIST_HELPER_INOUT(PriceList, SWIGTYPE_p_GNCPrice);
+// TODO: free PriceList?
 GLIST_HELPER_INOUT(CommodityList, SWIGTYPE_p_gnc_commodity);
 
 %typemap(newfree) gchar * "g_free($1);"
@@ -102,13 +103,6 @@ static const GncGUID * gncBudgetGetGUID(GncBudget *x)
 { return qof_instance_get_guid(QOF_INSTANCE(x)); }
 %}
 
-%typemap (freearg) AccountList * "g_list_free ($1);"
-%typemap (freearg) PriceList * "g_list_free ($1);"
-%typemap (freearg) SplitList * "g_list_free ($1);"
-%typemap (freearg) TransList * "g_list_free ($1);"
-%typemap (freearg) LotList * "g_list_free ($1);"
-%typemap (freearg) CommodityList * "g_list_free ($1);"
-
 /* NB: The object ownership annotations should already cover all the
 functions currently used in guile, but not all the functions that are
 wrapped.  So, we should contract the interface to wrap only the used



Summary of changes:
 bindings/engine.i | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)



More information about the gnucash-changes mailing list