gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Tue Jun 22 07:39:09 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/00983576 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/bd83c28a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e653c301 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a8aec07e (commit)
	from  https://github.com/Gnucash/gnucash/commit/b6277207 (commit)



commit 00983576f45df74b6c345e33e537d47b986bb359
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Jun 8 20:30:17 2021 +0800

    [split-register-model] don't strdup gnc_print_time64

diff --git a/gnucash/register/ledger-core/split-register-model.c b/gnucash/register/ledger-core/split-register-model.c
index a565af9e9..6124da164 100644
--- a/gnucash/register/ledger-core/split-register-model.c
+++ b/gnucash/register/ledger-core/split-register-model.c
@@ -993,7 +993,6 @@ gnc_split_register_get_date_help (VirtualLocation virt_loc,
 {
     SplitRegister* reg = user_data;
     BasicCell* cell;
-    const char* date_string;
     time64 cell_time;
 
     cell = gnc_table_get_cell (reg->table, virt_loc);
@@ -1004,9 +1003,7 @@ gnc_split_register_get_date_help (VirtualLocation virt_loc,
 
     /* Translators: This is a date format, see i.e.
        https://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html */
-    date_string = gnc_print_time64 (cell_time, _ ("%A %d %B %Y"));
-
-    return g_strdup (date_string);
+    return gnc_print_time64 (cell_time, _("%A %d %B %Y"));
 }
 
 static const char*

commit bd83c28a517c7823ac14fbc4358e4ed296a00dfe
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Jun 8 20:30:41 2021 +0800

    [gncEntryLedgerModel] don't strdup gnc_print_time64

diff --git a/gnucash/register/ledger-core/gncEntryLedgerModel.c b/gnucash/register/ledger-core/gncEntryLedgerModel.c
index 717b8349a..81aa10a36 100644
--- a/gnucash/register/ledger-core/gncEntryLedgerModel.c
+++ b/gnucash/register/ledger-core/gncEntryLedgerModel.c
@@ -567,7 +567,6 @@ static char * get_date_help (VirtualLocation virt_loc, gpointer user_data)
 {
     GncEntryLedger *ledger = user_data;
     BasicCell *cell;
-    const char *date_string;
     time64 cell_time;
 
     cell = gnc_table_get_cell (ledger->table, virt_loc);
@@ -575,10 +574,7 @@ static char * get_date_help (VirtualLocation virt_loc, gpointer user_data)
         return NULL;
 
     gnc_date_cell_get_date ((DateCell *) cell, &cell_time, FALSE);
-
-    date_string = gnc_print_time64 (cell_time, _("%A %d %B %Y"));
-
-    return g_strdup (date_string);
+    return gnc_print_time64 (cell_time, _("%A %d %B %Y"));
 }
 
 static char * get_desc_help (VirtualLocation virt_loc, gpointer user_data)

commit e653c30193171af438eda5aa788d68f72fcd9759
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Jun 11 20:39:53 2021 +0800

    [gnc-xml-backend] g_free char*

diff --git a/libgnucash/backend/xml/gnc-xml-backend.cpp b/libgnucash/backend/xml/gnc-xml-backend.cpp
index cc0b494f4..236afa80b 100644
--- a/libgnucash/backend/xml/gnc-xml-backend.cpp
+++ b/libgnucash/backend/xml/gnc-xml-backend.cpp
@@ -107,6 +107,7 @@ GncXmlBackend::check_path (const char* fullpath, bool create)
         g_free(dirname);
         return false;
     }
+    g_free(dirname);
     return true;
 }
 

commit a8aec07e8a9fcabec50bdee7a02238e151c582d3
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Jun 8 20:05:01 2021 +0800

    [import-main-matcher] reuse static string for color

diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index ce03a79d6..0c31c5a52 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -1347,15 +1347,19 @@ gnc_gen_trans_list_run (GNCImportMainMatcher *info)
     return result;
 }
 
-static gchar*
+static const gchar*
 get_required_color (const gchar *class_name)
 {
     GdkRGBA color;
+    static gchar *strbuf = NULL;
     GtkWidget *label = gtk_label_new ("Color");
     GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET(label));
     gtk_style_context_add_class (context, class_name);
     gnc_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &color);
-    return gdk_rgba_to_string (&color);
+    if (strbuf)
+        g_free (strbuf);
+    strbuf = gdk_rgba_to_string (&color);
+    return strbuf;
 }
 
 static void
@@ -1414,8 +1418,8 @@ refresh_model_row (GNCImportMainMatcher *gui,
 {
     GtkTreeStore *store;
     GtkTreeSelection *selection;
-    gchar *tmp, *imbalance, *text, *color;
-    const gchar *ro_text;
+    gchar *tmp, *imbalance, *text;
+    const gchar *ro_text, *color = NULL;
     gchar *int_required_class, *int_prob_required_class, *int_not_required_class;
     gchar *class_extension = NULL;
     gboolean show_pixbuf = TRUE;
@@ -1470,7 +1474,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
     /*Actions*/
 
     /* Action information */
-    ro_text = text = color = NULL;
+    ro_text = text = NULL;
     switch (gnc_import_TransInfo_get_action (info))
     {
     case GNCImport_ADD:



Summary of changes:
 gnucash/import-export/import-main-matcher.c         | 14 +++++++++-----
 gnucash/register/ledger-core/gncEntryLedgerModel.c  |  6 +-----
 gnucash/register/ledger-core/split-register-model.c |  5 +----
 libgnucash/backend/xml/gnc-xml-backend.cpp          |  1 +
 4 files changed, 12 insertions(+), 14 deletions(-)



More information about the gnucash-changes mailing list