From 7a25c12b9a78ff5c1b2eeca5ace53a257e18d473 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Tue, 19 Oct 2021 23:47:15 +0800 Subject: [PATCH] [dialog-sx-since-last-run] don't allocate repeatedly to combine strings --- gnucash/gnome/dialog-sx-since-last-run.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/gnucash/gnome/dialog-sx-since-last-run.c b/gnucash/gnome/dialog-sx-since-last-run.c index 5aba06020f..594cf4cb41 100644 --- a/gnucash/gnome/dialog-sx-since-last-run.c +++ b/gnucash/gnome/dialog-sx-since-last-run.c @@ -43,6 +43,7 @@ #include "gnc-prefs.h" #include "gnc-ui.h" #include "gnc-ui-util.h" +#include "gnc-glib-utils.h" #include "Query.h" #include "qof.h" #include "gnc-ledger-display.h" @@ -807,22 +808,11 @@ gnc_sx_slr_tree_model_adapter_new (GncSxInstanceModel *instances) static void creation_error_dialog (GList **creation_errors) { - GList *node = *creation_errors; GtkWidget *dialog = NULL; gchar *message = NULL; if (*creation_errors == NULL) return; - for(; node != NULL; node = g_list_next (node)) - { - gchar *new_msg = NULL; - if (message == NULL) - new_msg = g_strdup_printf ("%s", (gchar*)(node->data)); - else - new_msg = g_strdup_printf ("%s\n%s", message, (gchar*)(node->data)); - g_free (message); - message = new_msg; - g_free (node->data); - } - g_list_free (*creation_errors); + message = gnc_g_list_stringjoin (*creation_errors, "\n"); + g_list_free_full (*creation_errors, g_free); creation_errors = NULL; dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,