[glib/fix-gnulib-msvc-isnan: 18/37] gvalue: Static strings should not be copied
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/fix-gnulib-msvc-isnan: 18/37] gvalue: Static strings should not be copied
- Date: Tue, 9 Jun 2020 10:22:40 +0000 (UTC)
commit ce7616e74884624f120d2f0d55e2387b9710d410
Author: Edward Hervey <edward centricular com>
Date: Fri May 15 17:28:45 2020 +0200
gvalue: Static strings should not be copied
When doing copies of GValue backed by static strings, the contents should not be copied
gobject/gvaluetypes.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/gobject/gvaluetypes.c b/gobject/gvaluetypes.c
index 35b85c684..755ddeae1 100644
--- a/gobject/gvaluetypes.c
+++ b/gobject/gvaluetypes.c
@@ -271,7 +271,16 @@ static void
value_copy_string (const GValue *src_value,
GValue *dest_value)
{
- dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
+ if (src_value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS)
+ {
+ dest_value->data[0].v_pointer = src_value->data[0].v_pointer;
+ dest_value->data[1].v_uint = src_value->data[1].v_uint;
+ }
+ else
+ {
+ dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
+ dest_value->data[1].v_uint = src_value->data[1].v_uint;
+ }
}
static gchar*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]