gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Sat May 29 23:10:04 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/f37fa857 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/59386b40 (commit)
	from  https://github.com/Gnucash/gnucash/commit/292deb0a (commit)



commit f37fa85705f473318adc19c6bd77ca0c6754e1c4
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun May 30 08:10:49 2021 +0800

    build dom_tree_to_list_kvp_value more efficiently
    
    seems to be unused however

diff --git a/libgnucash/backend/xml/sixtp-dom-parsers.cpp b/libgnucash/backend/xml/sixtp-dom-parsers.cpp
index 0c047d02b..5d33afe19 100644
--- a/libgnucash/backend/xml/sixtp-dom-parsers.cpp
+++ b/libgnucash/backend/xml/sixtp-dom-parsers.cpp
@@ -321,10 +321,12 @@ dom_tree_to_list_kvp_value (xmlNodePtr node)
         new_val = dom_tree_to_kvp_value (mark);
         if (new_val)
         {
-            list = g_list_append (list, (gpointer)new_val);
+            list = g_list_prepend (list, (gpointer)new_val);
         }
     }
 
+    list = g_list_reverse (list);
+
     ret = new KvpValue {list};
 
     return ret;

commit 59386b4081dc8c71c59614011c945485b34ef594
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun May 30 08:10:19 2021 +0800

    gchar* dom_tree_to_text must be g_freed

diff --git a/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp b/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
index 1429a7106..8ee46c9ac 100644
--- a/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
+++ b/libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp
@@ -243,6 +243,7 @@ sx_enabled_handler (xmlNodePtr node, gpointer sx_pdata)
     gchar* tmp = dom_tree_to_text (node);
 
     sx->enabled = (g_strcmp0 (tmp, "y") == 0 ? TRUE : FALSE);
+    g_free (tmp);
 
     return TRUE;
 }
@@ -255,6 +256,7 @@ sx_autoCreate_handler (xmlNodePtr node, gpointer sx_pdata)
     gchar* tmp = dom_tree_to_text (node);
 
     sx->autoCreateOption = (g_strcmp0 (tmp, "y") == 0 ? TRUE : FALSE);
+    g_free (tmp);
 
     return TRUE;
 }
@@ -267,6 +269,7 @@ sx_notify_handler (xmlNodePtr node, gpointer sx_pdata)
     gchar* tmp = dom_tree_to_text (node);
 
     sx->autoCreateNotify = (g_strcmp0 (tmp, "y") == 0 ? TRUE : FALSE);
+    g_free (tmp);
 
     return TRUE;
 }
diff --git a/libgnucash/backend/xml/sixtp-dom-parsers.cpp b/libgnucash/backend/xml/sixtp-dom-parsers.cpp
index 646da445c..0c047d02b 100644
--- a/libgnucash/backend/xml/sixtp-dom-parsers.cpp
+++ b/libgnucash/backend/xml/sixtp-dom-parsers.cpp
@@ -152,16 +152,19 @@ dom_tree_to_boolean (xmlNodePtr node, gboolean* b)
     if (g_ascii_strncasecmp (text, "true", 4) == 0)
     {
         *b = TRUE;
+        g_free (text);
         return TRUE;
     }
     else if (g_ascii_strncasecmp (text, "false", 5) == 0)
     {
         *b = FALSE;
+        g_free (text);
         return TRUE;
     }
     else
     {
         *b = FALSE;
+        g_free (text);
         return FALSE;
     }
 }



Summary of changes:
 libgnucash/backend/xml/gnc-schedxaction-xml-v2.cpp | 3 +++
 libgnucash/backend/xml/sixtp-dom-parsers.cpp       | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list