[gjs] value: Avoid a copy/free when setting a string property
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] value: Avoid a copy/free when setting a string property
- Date: Mon, 10 Dec 2012 23:40:02 +0000 (UTC)
commit 8cf1c76f6f3011ff31cb17a825231d6f6c4cc6ca
Author: Colin Walters <walters verbum org>
Date: Mon Dec 10 18:21:50 2012 -0500
value: Avoid a copy/free when setting a string property
Just noticed while reading the code.
https://bugzilla.gnome.org/show_bug.cgi?id=690015
gi/value.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/gi/value.c b/gi/value.c
index 4d8de2f..18cd76b 100644
--- a/gi/value.c
+++ b/gi/value.c
@@ -242,8 +242,7 @@ gjs_value_to_g_value_internal(JSContext *context,
if (!gjs_string_to_utf8(context, value, &utf8_string))
return JS_FALSE;
- g_value_set_string(gvalue, utf8_string);
- g_free(utf8_string);
+ g_value_take_string(gvalue, utf8_string);
} else {
gjs_throw(context,
"Wrong type %s; string expected",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]