gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Tue Aug 3 08:31:25 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/23bd7164 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/67ecb107 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a3177e8b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e0d953bf (commit)
	from  https://github.com/Gnucash/gnucash/commit/b247c105 (commit)



commit 23bd7164511bf26af231097d2ee10da78fdd1fb7
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Jul 30 23:18:20 2021 +0800

    g_free gnc-path's gchar* intermediate strings

diff --git a/libgnucash/backend/dbi/gnc-backend-dbi.cpp b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
index db4877479..11030e19d 100644
--- a/libgnucash/backend/dbi/gnc-backend-dbi.cpp
+++ b/libgnucash/backend/dbi/gnc-backend-dbi.cpp
@@ -1100,7 +1100,9 @@ gnc_module_init_backend_dbi (void)
 #endif
     if (num_drivers <= 0)
     {
-        gchar* dir = g_build_filename (gnc_path_get_libdir (), "dbd", nullptr);
+        gchar *libdir = gnc_path_get_libdir ();
+        gchar *dir = g_build_filename (libdir, "dbd", nullptr);
+        g_free (libdir);
 #if HAVE_LIBDBI_R
         if (dbi_instance)
             return;
diff --git a/libgnucash/core-utils/gnc-filepath-utils.cpp b/libgnucash/core-utils/gnc-filepath-utils.cpp
index d26f5fb6a..34f482d4c 100644
--- a/libgnucash/core-utils/gnc-filepath-utils.cpp
+++ b/libgnucash/core-utils/gnc-filepath-utils.cpp
@@ -1174,7 +1174,9 @@ gnc_build_data_path (const gchar *filename)
 gchar *
 gnc_build_scm_path (const gchar *filename)
 {
-    gchar *result = g_build_filename(gnc_path_get_scmdir(), filename, (gchar *)NULL);
+    gchar *scmdir = gnc_path_get_scmdir ();
+    gchar *result = g_build_filename (scmdir, filename, (gchar *)NULL);
+    g_free (scmdir);
     return result;
 }
 
@@ -1190,7 +1192,9 @@ gnc_build_scm_path (const gchar *filename)
 gchar *
 gnc_build_report_path (const gchar *filename)
 {
-    gchar *result = g_build_filename(gnc_path_get_reportdir(), filename, (gchar *)NULL);
+    gchar *rptdir = gnc_path_get_reportdir ();
+    gchar *result = g_build_filename (rptdir, filename, (gchar *)NULL);
+    g_free (rptdir);
     return result;
 }
 
@@ -1206,7 +1210,9 @@ gnc_build_report_path (const gchar *filename)
 gchar *
 gnc_build_reports_path (const gchar *dirname)
 {
-    gchar *result = g_build_filename(gnc_path_get_reportsdir(), dirname, (gchar *)NULL);
+    gchar *rptsdir = gnc_path_get_reportsdir ();
+    gchar *result = g_build_filename (rptsdir, dirname, (gchar *)NULL);
+    g_free (rptsdir);
     return result;
 }
 
@@ -1222,7 +1228,9 @@ gnc_build_reports_path (const gchar *dirname)
 gchar *
 gnc_build_stdreports_path (const gchar *filename)
 {
-    gchar *result = g_build_filename(gnc_path_get_stdreportsdir(), filename, (gchar *)NULL);
+    gchar *stdrptdir = gnc_path_get_stdreportsdir ();
+    gchar *result = g_build_filename (stdrptdir, filename, (gchar *)NULL);
+    g_free (stdrptdir);
     return result;
 }
 
@@ -1253,7 +1261,10 @@ gnc_filepath_locate_file (const gchar *default_path, const gchar *name)
 gchar *
 gnc_filepath_locate_data_file (const gchar *name)
 {
-    return gnc_filepath_locate_file (gnc_path_get_pkgdatadir(), name);
+    gchar *pkgdatadir = gnc_path_get_pkgdatadir ();
+    gchar *result = gnc_filepath_locate_file (pkgdatadir, name);
+    g_free (pkgdatadir);
+    return result;
 }
 
 gchar *
@@ -1289,7 +1300,10 @@ gnc_filepath_locate_ui_file (const gchar *name)
 gchar *
 gnc_filepath_locate_doc_file (const gchar *name)
 {
-    return gnc_filepath_locate_file (gnc_path_get_pkgdocdir(), name);
+    gchar *docdir = gnc_path_get_pkgdocdir ();
+    gchar *result = gnc_filepath_locate_file (docdir, name);
+    g_free (docdir);
+    return result;
 }
 
 

commit 67ecb1074f2a407c5c07dfbbf71a6509d92ba991
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Jul 30 23:16:45 2021 +0800

    [assistant-hierarchy.c] g_free data->gnc_accounts_dir
    
    because it is assigned to gnc_path_get_accountsdir() which is a *gchar
    and must be freed.

diff --git a/gnucash/gnome/assistant-hierarchy.c b/gnucash/gnome/assistant-hierarchy.c
index cc37ee085..38f540ed4 100644
--- a/gnucash/gnome/assistant-hierarchy.c
+++ b/gnucash/gnome/assistant-hierarchy.c
@@ -96,7 +96,7 @@ typedef struct
     GtkWidget   *region_combo;
     GtkWidget   *region_label;
 
-    const gchar *gnc_accounts_dir;
+    gchar *gnc_accounts_dir;
 
     GtkTreeView *categories_tree;
     GtkTreeRowReference *initial_category;
@@ -170,6 +170,8 @@ gnc_hierarchy_destroy_cb (GtkWidget *obj,   hierarchy_data *data)
         g_hash_table_destroy (hash);
         data->balance_hash = NULL;
     }
+
+    g_free (data->gnc_accounts_dir);
 }
 
 static gnc_numeric

commit a3177e8b6bbe8f85e4ded4d7048515c42c879041
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Aug 1 11:00:37 2021 +0800

    [swig] %newobject to g_free AccountList* functions

diff --git a/bindings/engine-common.i b/bindings/engine-common.i
index 52e62d383..b4d861dd6 100644
--- a/bindings/engine-common.i
+++ b/bindings/engine-common.i
@@ -36,10 +36,18 @@ static const GncGUID * gncAccountGetGUID(Account *x)
 
 %include <Split.h>
 
+%newobject gnc_account_get_children;
 AccountList * gnc_account_get_children (const Account *account);
+
+%newobject gnc_account_get_children_sorted;
 AccountList * gnc_account_get_children_sorted (const Account *account);
+
+%newobject gnc_account_get_descendants;
 AccountList * gnc_account_get_descendants (const Account *account);
+
+%newobject gnc_account_get_descendants_sorted;
 AccountList * gnc_account_get_descendants_sorted (const Account *account);
+
 %ignore gnc_account_get_children;
 %ignore gnc_account_get_children_sorted;
 %ignore gnc_account_get_descendants;

commit e0d953bfc895e1046e3f183d092717dd4c43b6dc
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Jul 30 23:16:01 2021 +0800

    [swig] %newobject to g_free gchar* functions

diff --git a/bindings/core-utils.i b/bindings/core-utils.i
index 288e5c1d6..e5cd3cf54 100644
--- a/bindings/core-utils.i
+++ b/bindings/core-utils.i
@@ -78,9 +78,16 @@ gchar * gnc_build_userdata_path(const gchar *);
 %newobject gnc_file_path_absolute;
 gchar *gnc_file_path_absolute (const gchar *, const gchar *);
 
+%newobject gnc_build_scm_path;
 gchar * gnc_build_scm_path(const gchar *);
+
+%newobject gnc_build_report_path;
 gchar * gnc_build_report_path(const gchar *);
+
+%newobject gnc_build_stdreports_path;
 gchar * gnc_build_stdreports_path(const gchar *);
+
+%newobject gnc_build_reports_path;
 gchar * gnc_build_reports_path(const gchar *);
 
 void gnc_scm_log_warn(const gchar *);
diff --git a/bindings/engine.i b/bindings/engine.i
index ef273a577..e9130a248 100644
--- a/bindings/engine.i
+++ b/bindings/engine.i
@@ -190,6 +190,8 @@ const char *qof_session_get_url (QofSession *session);
 
 %ignore qof_print_date_time_buff;
 %ignore gnc_tm_free;
+%newobject qof_print_date;
+%newobject gnc_print_time64;
 %include <gnc-date.h>
 extern const char *gnc_default_strftime_date_format;
 



Summary of changes:
 bindings/core-utils.i                        |  7 +++++++
 bindings/engine-common.i                     |  8 ++++++++
 bindings/engine.i                            |  2 ++
 gnucash/gnome/assistant-hierarchy.c          |  4 +++-
 libgnucash/backend/dbi/gnc-backend-dbi.cpp   |  4 +++-
 libgnucash/core-utils/gnc-filepath-utils.cpp | 26 ++++++++++++++++++++------
 6 files changed, 43 insertions(+), 8 deletions(-)



More information about the gnucash-changes mailing list