[gjs] context: Move SetCStringsAreUTF8 to class_init
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] context: Move SetCStringsAreUTF8 to class_init
- Date: Thu, 28 Feb 2013 01:21:13 +0000 (UTC)
commit cd3f528fcc9da29c76e3688b12a097bf8f8a7bfe
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Feb 27 18:23:28 2013 -0500
context: Move SetCStringsAreUTF8 to class_init
Rather than use g_once_init_enter, simply use the standard
place for the one-time initialization sequence.
https://bugzilla.gnome.org/show_bug.cgi?id=694828
gjs/context.c | 14 ++------------
1 files changed, 2 insertions(+), 12 deletions(-)
---
diff --git a/gjs/context.c b/gjs/context.c
index 79a018a..627921a 100644
--- a/gjs/context.c
+++ b/gjs/context.c
@@ -343,6 +343,8 @@ gjs_context_class_init(GjsContextClass *klass)
NULL,
G_TYPE_NONE, 0);
+ JS_SetCStringsAreUTF8();
+
gjs_register_native_module("byteArray", gjs_define_byte_array_stuff, 0);
gjs_register_native_module("_gi", gjs_define_private_gi_stuff, 0);
}
@@ -523,16 +525,6 @@ static JSLocaleCallbacks gjs_locale_callbacks =
gjs_locale_to_unicode
};
-static void
-set_c_strings_are_utf8_if_needed (void)
-{
- static gsize init = 0;
- if (g_once_init_enter (&init)) {
- JS_SetCStringsAreUTF8();
- g_once_init_leave (&init, 1);
- }
-}
-
static GObject*
gjs_context_constructor (GType type,
guint n_construct_properties,
@@ -547,8 +539,6 @@ gjs_context_constructor (GType type,
n_construct_properties,
construct_params);
- set_c_strings_are_utf8_if_needed ();
-
js_context = GJS_CONTEXT(object);
js_context->runtime = JS_NewRuntime(32*1024*1024 /* max bytes */);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]