From 41aeff331d4f8121fda17a3a47eb72a7a4e26b85 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 10 Jan 2023 22:20:57 -0500 Subject: [PATCH] texthistory: Avoid g_autofree msvc does not like it, unfortunately. --- gtk/gtktexthistory.c | 56 +++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/gtk/gtktexthistory.c b/gtk/gtktexthistory.c index afb7f90282..614724112a 100644 --- a/gtk/gtktexthistory.c +++ b/gtk/gtktexthistory.c @@ -156,8 +156,6 @@ gtk_text_history_printf_action (Action *action, GString *str, guint depth) { - g_autofree char *escaped = NULL; - gtk_text_history_printf_space (str, depth); g_string_append_printf (str, "%s {\n", action_kind_name (action->kind)); @@ -177,31 +175,41 @@ gtk_text_history_printf_action (Action *action, case ACTION_KIND_DELETE_KEY: case ACTION_KIND_DELETE_PROGRAMMATIC: case ACTION_KIND_DELETE_SELECTION: - gtk_text_history_printf_space (str, depth+1); - g_string_append_printf (str, "begin: %u\n", action->u.delete.begin); - gtk_text_history_printf_space (str, depth+1); - g_string_append_printf (str, "end: %u\n", action->u.delete.end); - gtk_text_history_printf_space (str, depth+1); - g_string_append (str, "selection {\n"); - gtk_text_history_printf_space (str, depth+2); - g_string_append_printf (str, "insert: %d\n", action->u.delete.selection.insert); - gtk_text_history_printf_space (str, depth+2); - g_string_append_printf (str, "bound: %d\n", action->u.delete.selection.bound); - gtk_text_history_printf_space (str, depth+1); - g_string_append (str, "}\n"); - gtk_text_history_printf_space (str, depth+1); - escaped = g_strescape (istring_str (&action->u.delete.istr), NULL); - g_string_append_printf (str, "text: \"%s\"\n", escaped); + { + char *escaped; + + gtk_text_history_printf_space (str, depth+1); + g_string_append_printf (str, "begin: %u\n", action->u.delete.begin); + gtk_text_history_printf_space (str, depth+1); + g_string_append_printf (str, "end: %u\n", action->u.delete.end); + gtk_text_history_printf_space (str, depth+1); + g_string_append (str, "selection {\n"); + gtk_text_history_printf_space (str, depth+2); + g_string_append_printf (str, "insert: %d\n", action->u.delete.selection.insert); + gtk_text_history_printf_space (str, depth+2); + g_string_append_printf (str, "bound: %d\n", action->u.delete.selection.bound); + gtk_text_history_printf_space (str, depth+1); + g_string_append (str, "}\n"); + gtk_text_history_printf_space (str, depth+1); + escaped = g_strescape (istring_str (&action->u.delete.istr), NULL); + g_string_append_printf (str, "text: \"%s\"\n", escaped); + g_free (escaped); + } break; case ACTION_KIND_INSERT: - gtk_text_history_printf_space (str, depth+1); - g_string_append_printf (str, "begin: %u\n", action->u.insert.begin); - gtk_text_history_printf_space (str, depth+1); - g_string_append_printf (str, "end: %u\n", action->u.insert.end); - gtk_text_history_printf_space (str, depth+1); - escaped = g_strescape (istring_str (&action->u.insert.istr), NULL); - g_string_append_printf (str, "text: \"%s\"\n", escaped); + { + char *escaped; + + gtk_text_history_printf_space (str, depth+1); + g_string_append_printf (str, "begin: %u\n", action->u.insert.begin); + gtk_text_history_printf_space (str, depth+1); + g_string_append_printf (str, "end: %u\n", action->u.insert.end); + gtk_text_history_printf_space (str, depth+1); + escaped = g_strescape (istring_str (&action->u.insert.istr), NULL); + g_string_append_printf (str, "text: \"%s\"\n", escaped); + g_free (escaped); + } break; case ACTION_KIND_GROUP: -- 2.30.2