From: Garrett Regier Date: Thu, 23 Sep 2021 22:26:56 +0000 (-0700) Subject: builder: Use g_slice_free_chain() for strings in precompile X-Git-Tag: archive/raspbian/4.6.5+ds-1+rpi1~1^2~19^2~5^2~56^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=fcb6adaaaa66e859c8404807455c8f33c41ccf30;p=gtk4.git builder: Use g_slice_free_chain() for strings in precompile --- diff --git a/gtk/gtkbuilderprecompile.c b/gtk/gtkbuilderprecompile.c index b75a0023a7..7c8dac9a5a 100644 --- a/gtk/gtkbuilderprecompile.c +++ b/gtk/gtkbuilderprecompile.c @@ -34,13 +34,15 @@ typedef enum /* All strings are owned by the string chunk */ typedef struct { + /* Must be first for g_slice_free_chain() */ + GList link; + const char *string; int len; int count; int offset; int text_offset; gboolean include_len; - GList link; } RecordDataString; typedef struct { @@ -153,12 +155,6 @@ record_data_node_free (RecordDataNode *node) } } -static void -record_data_string_free (RecordDataString *s) -{ - g_slice_free (RecordDataString, s); -} - static gboolean record_data_string_equal (gconstpointer _a, gconstpointer _b) @@ -435,8 +431,7 @@ _gtk_buildable_parser_precompile (const char *text, GString *marshaled; int offset; - data.strings = g_hash_table_new_full (record_data_string_hash, record_data_string_equal, - (GDestroyNotify)record_data_string_free, NULL); + data.strings = g_hash_table_new (record_data_string_hash, record_data_string_equal); data.chunks = g_string_chunk_new (512); data.root = record_data_element_new (NULL, NULL, 0); data.current = data.root; @@ -489,6 +484,9 @@ _gtk_buildable_parser_precompile (const char *text, marshal_root (marshaled, &data.root->base); + g_slice_free_chain (RecordDataString, + (RecordDataString *)data.string_list.head, + link.next); record_data_node_free (&data.root->base); g_string_chunk_free (data.chunks); g_hash_table_destroy (data.strings);