[glib: 6/19] gbinding: Avoid a string copy of interned property names
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 6/19] gbinding: Avoid a string copy of interned property names
- Date: Thu, 12 Dec 2019 12:11:50 +0000 (UTC)
commit 26970edc9fafad8efefa50f26d35e597bda540d7
Author: Philip Withnall <withnall endlessm com>
Date: Tue Nov 12 19:31:25 2019 +0000
gbinding: Avoid a string copy of interned property names
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 <withnall endlessm com>
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:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]