[gjs/wip/ptomato/various: 1/2] WIP - extra roots
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/various: 1/2] WIP - extra roots
- Date: Tue, 7 Feb 2017 22:55:21 +0000 (UTC)
commit 2c091b923f2b00fc79aaa6243582021d9e04e30f
Author: Philip Chimento <philip endlessm com>
Date: Tue Feb 7 14:50:22 2017 -0800
WIP - extra roots
gi/fundamental.cpp | 10 +++++-----
gjs/jsapi-util-string.cpp | 13 +++++--------
2 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index 4df78f4..6647f2a 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -203,9 +203,9 @@ associate_js_instance_to_fundamental(JSContext *context,
/* Find the first constructor */
static GIFunctionInfo *
-find_fundamental_constructor(JSContext *context,
- GIObjectInfo *info,
- jsid *constructor_name)
+find_fundamental_constructor(JSContext *context,
+ GIObjectInfo *info,
+ JS::MutableHandleId constructor_name)
{
int i, n_methods;
@@ -222,7 +222,7 @@ find_fundamental_constructor(JSContext *context,
const char *name;
name = g_base_info_get_name((GIBaseInfo *) func_info);
- *constructor_name = gjs_intern_string_to_id(context, name);
+ constructor_name.set(gjs_intern_string_to_id(context, name));
return func_info;
}
@@ -656,7 +656,7 @@ gjs_define_fundamental_class(JSContext *context,
JS::MutableHandleObject prototype)
{
const char *constructor_name;
- jsid js_constructor_name = JSID_VOID;
+ JS::RootedId js_constructor_name(context);
JS::RootedObject parent_proto(context);
Fundamental *priv;
GType parent_gtype;
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index 6143b47..1f0a47f 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -351,14 +351,11 @@ gjs_unichar_from_string (JSContext *context,
}
jsid
-gjs_intern_string_to_id (JSContext *context,
- const char *string)
+gjs_intern_string_to_id(JSContext *cx,
+ const char *string)
{
- JSString *str;
- jsid id;
- JS_BeginRequest(context);
- str = JS_InternString(context, string);
- id = INTERNED_STRING_TO_JSID(context, str);
- JS_EndRequest(context);
+ JSAutoRequest ar(cx);
+ JS::RootedString str(cx, JS_InternString(cx, string));
+ JS::RootedId id(cx, INTERNED_STRING_TO_JSID(cx, str));
return id;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]