From 26970edc9fafad8efefa50f26d35e597bda540d7 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 12 Nov 2019 19:31:25 +0000 Subject: [PATCH] gbinding: Avoid a string copy of interned property names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Interned strings are never freed, so we don’t need to take a copy of them when returning them in a #GValue. This is a minor memory allocation improvement, with no functional changes. Signed-off-by: Philip Withnall --- gobject/gbinding.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gobject/gbinding.c b/gobject/gbinding.c index bed3fce10..12475bcdd 100644 --- a/gobject/gbinding.c +++ b/gobject/gbinding.c @@ -539,7 +539,8 @@ g_binding_get_property (GObject *gobject, break; case PROP_SOURCE_PROPERTY: - g_value_set_string (value, binding->source_property); + /* @source_property is interned, so we don’t need to take a copy */ + g_value_set_static_string (value, binding->source_property); break; case PROP_TARGET: @@ -547,7 +548,8 @@ g_binding_get_property (GObject *gobject, break; case PROP_TARGET_PROPERTY: - g_value_set_string (value, binding->target_property); + /* @target_property is interned, so we don’t need to take a copy */ + g_value_set_static_string (value, binding->target_property); break; case PROP_FLAGS: