[gjs/wip/js17: 4/12] Context argument removed from several API
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/js17: 4/12] Context argument removed from several API
- Date: Sun, 10 Mar 2013 21:35:12 +0000 (UTC)
commit f64acfe8748d5877d9d58a75dc45f4724faf7ad3
Author: Tim Lunn <tim feathertop org>
Date: Thu Jan 3 15:08:19 2013 +1100
Context argument removed from several API
JS_SetPrivate/JS_GetPrivate/JS_GetPrototype no longer require context as first arg.
https://bugzilla.gnome.org/show_bug.cgi?id=690982
gi/boxed.c | 10 +++++-----
gi/function.c | 4 ++--
gi/gerror.c | 8 ++++----
gi/gtype.c | 2 +-
gi/interface.c | 2 +-
gi/keep-alive.c | 4 ++--
gi/ns.c | 2 +-
gi/object.c | 8 ++++----
gi/param.c | 2 +-
gi/repo.c | 2 +-
gi/union.c | 8 ++++----
gjs/byteArray.c | 8 ++++----
gjs/importer.c | 2 +-
gjs/jsapi-dynamic-class.c | 2 +-
gjs/jsapi-util.c | 2 +-
modules/cairo-context.c | 2 +-
modules/cairo-path.c | 6 +++---
modules/cairo-pattern.c | 6 +++---
modules/cairo-surface.c | 6 +++---
19 files changed, 43 insertions(+), 43 deletions(-)
---
diff --git a/gi/boxed.c b/gi/boxed.c
index bbea2c7..464834e 100644
--- a/gi/boxed.c
+++ b/gi/boxed.c
@@ -443,13 +443,13 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(boxed)
GJS_INC_COUNTER(boxed);
g_assert(priv_from_js(context, object) == NULL);
- JS_SetPrivate(context, object, priv);
+ JS_SetPrivate(object, priv);
gjs_debug_lifecycle(GJS_DEBUG_GBOXED,
"boxed constructor, obj %p priv %p",
object, priv);
- proto = JS_GetPrototype(context, object);
+ proto = JS_GetPrototype(object);
gjs_debug_lifecycle(GJS_DEBUG_GBOXED, "boxed instance __proto__ is %p", proto);
/* If we're the prototype, then post-construct we'll fill in priv->info.
* If we are not the prototype, though, then we'll get ->info from the
@@ -606,7 +606,7 @@ get_nested_interface_object (JSContext *context,
GJS_INC_COUNTER(boxed);
priv = g_slice_new0(Boxed);
- JS_SetPrivate(context, obj, priv);
+ JS_SetPrivate(obj, priv);
priv->info = (GIBoxedInfo*) interface_info;
g_base_info_ref( (GIBaseInfo*) priv->info);
priv->gtype = g_registered_type_info_get_g_type ((GIRegisteredTypeInfo*) interface_info);
@@ -1239,7 +1239,7 @@ gjs_define_boxed_class(JSContext *context,
g_base_info_ref( (GIBaseInfo*) priv->info);
priv->gtype = g_registered_type_info_get_g_type ((GIRegisteredTypeInfo*) priv->info);
- JS_SetPrivate(context, prototype, priv);
+ JS_SetPrivate(prototype, priv);
gjs_debug(GJS_DEBUG_GBOXED, "Defined class %s prototype is %p class %p in object %p",
constructor_name, prototype, JS_GetClass(prototype), in_object);
@@ -1293,7 +1293,7 @@ gjs_boxed_from_c_struct(JSContext *context,
*priv = *proto_priv;
g_base_info_ref( (GIBaseInfo*) priv->info);
- JS_SetPrivate(context, obj, priv);
+ JS_SetPrivate(obj, priv);
if ((flags & GJS_BOXED_CREATION_NO_COPY) != 0) {
/* we need to create a JS Boxed which references the
diff --git a/gi/function.c b/gi/function.c
index a37fb85..1d9f2ad 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -1549,7 +1549,7 @@ function_new(JSContext *context,
JS_GetProperty(context, global, "Function", &native_function);
/* We take advantage from that fact that Function.__proto__ is Function.prototype */
- parent_proto = JS_GetPrototype(context, JSVAL_TO_OBJECT(native_function));
+ parent_proto = JS_GetPrototype(JSVAL_TO_OBJECT(native_function));
prototype = JS_InitClass(context, global,
/* parent prototype JSObject* for
@@ -1594,7 +1594,7 @@ function_new(JSContext *context,
GJS_INC_COUNTER(function);
g_assert(priv_from_js(context, function) == NULL);
- JS_SetPrivate(context, function, priv);
+ JS_SetPrivate(function, priv);
gjs_debug_lifecycle(GJS_DEBUG_GFUNCTION,
"function constructor, obj %p priv %p", function, priv);
diff --git a/gi/gerror.c b/gi/gerror.c
index ea36b18..5fd12b6 100644
--- a/gi/gerror.c
+++ b/gi/gerror.c
@@ -77,13 +77,13 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(error)
GJS_INC_COUNTER(gerror);
g_assert(priv_from_js(context, object) == NULL);
- JS_SetPrivate(context, object, priv);
+ JS_SetPrivate(object, priv);
gjs_debug_lifecycle(GJS_DEBUG_GERROR,
"GError constructor, obj %p priv %p",
object, priv);
- proto = JS_GetPrototype(context, object);
+ proto = JS_GetPrototype(object);
gjs_debug_lifecycle(GJS_DEBUG_GERROR, "GError instance __proto__ is %p", proto);
/* If we're the prototype, then post-construct we'll fill in priv->info.
@@ -460,7 +460,7 @@ gjs_define_error_class(JSContext *context,
g_base_info_ref( (GIBaseInfo*) priv->info);
priv->domain = g_quark_from_string (g_enum_info_get_error_domain(priv->info));
- JS_SetPrivate(context, prototype, priv);
+ JS_SetPrivate(prototype, priv);
gjs_debug(GJS_DEBUG_GBOXED, "Defined class %s prototype is %p class %p in object %p",
constructor_name, prototype, JS_GetClass(prototype), in_object);
@@ -595,7 +595,7 @@ gjs_error_from_gerror(JSContext *context,
GJS_INC_COUNTER(gerror);
priv = g_slice_new0(Error);
- JS_SetPrivate(context, obj, priv);
+ JS_SetPrivate(obj, priv);
priv->info = info;
priv->domain = proto_priv->domain;
g_base_info_ref( (GIBaseInfo*) priv->info);
diff --git a/gi/gtype.c b/gi/gtype.c
index ba3954c..5bcdd6f 100644
--- a/gi/gtype.c
+++ b/gi/gtype.c
@@ -134,7 +134,7 @@ gjs_gtype_create_gtype_wrapper (JSContext *context,
if (object == NULL)
goto out;
- JS_SetPrivate(context, object, GSIZE_TO_POINTER(gtype));
+ JS_SetPrivate(object, GSIZE_TO_POINTER(gtype));
g_type_set_qdata(gtype, gjs_get_gtype_wrapper_quark(), object);
out:
diff --git a/gi/interface.c b/gi/interface.c
index 43d7019..e447ba4 100644
--- a/gi/interface.c
+++ b/gi/interface.c
@@ -231,7 +231,7 @@ gjs_define_interface_class(JSContext *context,
priv->info = info;
priv->gtype = g_registered_type_info_get_g_type(priv->info);
g_base_info_ref((GIBaseInfo*)priv->info);
- JS_SetPrivate(context, prototype, priv);
+ JS_SetPrivate(prototype, priv);
gjs_define_static_methods(context, constructor, priv->gtype, priv->info);
diff --git a/gi/keep-alive.c b/gi/keep-alive.c
index 581c9ad..ce56e35 100644
--- a/gi/keep-alive.c
+++ b/gi/keep-alive.c
@@ -133,7 +133,7 @@ keep_alive_trace(JSTracer *tracer,
{
KeepAlive *priv;
- priv = JS_GetPrivate(tracer->context, obj);
+ priv = JS_GetPrivate(obj);
if (priv == NULL) /* prototype */
return;
@@ -251,7 +251,7 @@ gjs_keep_alive_new(JSContext *context)
priv->children = g_hash_table_new_full(child_hash, child_equal, NULL, child_free);
g_assert(priv_from_js(context, keep_alive) == NULL);
- JS_SetPrivate(context, keep_alive, priv);
+ JS_SetPrivate(keep_alive, priv);
gjs_debug_lifecycle(GJS_DEBUG_KEEP_ALIVE,
"keep_alive constructor, obj %p priv %p", keep_alive, priv);
diff --git a/gi/ns.c b/gi/ns.c
index 9bf7ef2..8d8930b 100644
--- a/gi/ns.c
+++ b/gi/ns.c
@@ -230,7 +230,7 @@ ns_new(JSContext *context,
GJS_INC_COUNTER(ns);
g_assert(priv_from_js(context, ns) == NULL);
- JS_SetPrivate(context, ns, priv);
+ JS_SetPrivate(ns, priv);
gjs_debug_lifecycle(GJS_DEBUG_GNAMESPACE, "ns constructor, obj %p priv %p", ns, priv);
diff --git a/gi/object.c b/gi/object.c
index dab446e..13dfbf9 100644
--- a/gi/object.c
+++ b/gi/object.c
@@ -212,7 +212,7 @@ static inline ObjectInstance *
proto_priv_from_js(JSContext *context,
JSObject *obj)
{
- return priv_from_js(context, JS_GetPrototype(context, obj));
+ return priv_from_js(context, JS_GetPrototype(obj));
}
/* a hook on getting a property; set value_p to override property's value.
@@ -838,7 +838,7 @@ init_object_private (JSContext *context,
GJS_INC_COUNTER(object);
g_assert(priv_from_js(context, object) == NULL);
- JS_SetPrivate(context, object, priv);
+ JS_SetPrivate(object, priv);
gjs_debug_lifecycle(GJS_DEBUG_GOBJECT,
"obj instance constructor, obj %p priv %p", object, priv);
@@ -1026,7 +1026,7 @@ object_instance_trace(JSTracer *tracer,
ObjectInstance *priv;
GList *iter;
- priv = JS_GetPrivate(tracer->context, obj);
+ priv = JS_GetPrivate(obj);
for (iter = priv->signals; iter; iter = iter->next) {
ConnectData *cd = iter->data;
@@ -1689,7 +1689,7 @@ gjs_define_object_class(JSContext *context,
g_base_info_ref( (GIBaseInfo*) priv->info);
priv->gtype = gtype;
priv->klass = g_type_class_ref (gtype);
- JS_SetPrivate(context, prototype, priv);
+ JS_SetPrivate(prototype, priv);
gjs_debug(GJS_DEBUG_GOBJECT, "Defined class %s prototype %p class %p in object %p",
constructor_name, prototype, JS_GetClass(prototype), in_object);
diff --git a/gi/param.c b/gi/param.c
index 8e6d67d..aaddc5b 100644
--- a/gi/param.c
+++ b/gi/param.c
@@ -566,7 +566,7 @@ gjs_param_from_g_param(JSContext *context,
GJS_INC_COUNTER(param);
priv = g_slice_new0(Param);
- JS_SetPrivate(context, obj, priv);
+ JS_SetPrivate(obj, priv);
priv->gparam = gparam;
g_param_spec_ref (gparam);
diff --git a/gi/repo.c b/gi/repo.c
index 86dcd19..c14ff7a 100644
--- a/gi/repo.c
+++ b/gi/repo.c
@@ -293,7 +293,7 @@ repo_new(JSContext *context)
GJS_INC_COUNTER(repo);
g_assert(priv_from_js(context, repo) == NULL);
- JS_SetPrivate(context, repo, priv);
+ JS_SetPrivate(repo, priv);
gjs_debug_lifecycle(GJS_DEBUG_GREPO,
"repo constructor, obj %p priv %p", repo, priv);
diff --git a/gi/union.c b/gi/union.c
index bfd7501..19e3491 100644
--- a/gi/union.c
+++ b/gi/union.c
@@ -202,13 +202,13 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(union)
GJS_INC_COUNTER(boxed);
g_assert(priv_from_js(context, object) == NULL);
- JS_SetPrivate(context, object, priv);
+ JS_SetPrivate(object, priv);
gjs_debug_lifecycle(GJS_DEBUG_GBOXED,
"union constructor, obj %p priv %p",
object, priv);
- proto = JS_GetPrototype(context, object);
+ proto = JS_GetPrototype(object);
gjs_debug_lifecycle(GJS_DEBUG_GBOXED, "union instance __proto__ is %p", proto);
/* If we're the prototype, then post-construct we'll fill in priv->info.
@@ -460,7 +460,7 @@ gjs_define_union_class(JSContext *context,
priv->info = info;
g_base_info_ref( (GIBaseInfo*) priv->info);
priv->gtype = gtype;
- JS_SetPrivate(context, prototype, priv);
+ JS_SetPrivate(prototype, priv);
gjs_debug(GJS_DEBUG_GBOXED, "Defined class %s prototype is %p class %p in object %p",
constructor_name, prototype, JS_GetClass(prototype), in_object);
@@ -512,7 +512,7 @@ gjs_union_from_c_union(JSContext *context,
GJS_INC_COUNTER(boxed);
priv = g_slice_new0(Union);
- JS_SetPrivate(context, obj, priv);
+ JS_SetPrivate(obj, priv);
priv->info = info;
g_base_info_ref( (GIBaseInfo *) priv->info);
priv->gtype = gtype;
diff --git a/gjs/byteArray.c b/gjs/byteArray.c
index 3b44ecf..33852b1 100644
--- a/gjs/byteArray.c
+++ b/gjs/byteArray.c
@@ -452,7 +452,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(byte_array)
priv = g_slice_new0(ByteArrayInstance);
priv->array = gjs_g_byte_array_new(preallocated_length);
g_assert(priv_from_js(context, object) == NULL);
- JS_SetPrivate(context, object, priv);
+ JS_SetPrivate(object, priv);
GJS_NATIVE_CONSTRUCTOR_FINISH(byte_array);
@@ -615,7 +615,7 @@ byte_array_new(JSContext *context)
priv = g_slice_new0(ByteArrayInstance);
g_assert(priv_from_js(context, array) == NULL);
- JS_SetPrivate(context, array, priv);
+ JS_SetPrivate(array, priv);
return array;
}
@@ -867,7 +867,7 @@ gjs_byte_array_from_byte_array (JSContext *context,
priv = g_slice_new0(ByteArrayInstance);
g_assert(priv_from_js(context, object) == NULL);
- JS_SetPrivate(context, object, priv);
+ JS_SetPrivate(object, priv);
priv->array = g_byte_array_new();
priv->array->data = g_memdup(array->data, array->len);
priv->array->len = array->len;
@@ -896,7 +896,7 @@ gjs_byte_array_from_bytes (JSContext *context,
priv = g_slice_new0(ByteArrayInstance);
g_assert(priv_from_js(context, object) == NULL);
- JS_SetPrivate(context, object, priv);
+ JS_SetPrivate(object, priv);
priv->bytes = g_bytes_ref (bytes);
return object;
diff --git a/gjs/importer.c b/gjs/importer.c
index fbc9873..7bfc6fd 100644
--- a/gjs/importer.c
+++ b/gjs/importer.c
@@ -1053,7 +1053,7 @@ importer_new(JSContext *context)
GJS_INC_COUNTER(importer);
g_assert(priv_from_js(context, importer) == NULL);
- JS_SetPrivate(context, importer, priv);
+ JS_SetPrivate(importer, priv);
gjs_debug_lifecycle(GJS_DEBUG_IMPORTER,
"importer constructor, obj %p priv %p", importer, priv);
diff --git a/gjs/jsapi-dynamic-class.c b/gjs/jsapi-dynamic-class.c
index e0df4dc..ab8c530 100644
--- a/gjs/jsapi-dynamic-class.c
+++ b/gjs/jsapi-dynamic-class.c
@@ -52,7 +52,7 @@ gjs_new_object_for_constructor(JSContext *context,
jsval prototype;
callee = JS_CALLEE(context, vp);
- parent = JS_GetParent(context, JSVAL_TO_OBJECT (callee));
+ parent = JS_GetParent(JSVAL_TO_OBJECT (callee));
if (!gjs_object_get_property(context, JSVAL_TO_OBJECT (callee), "prototype",
&prototype))
diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
index 2bf38be..5451969 100644
--- a/gjs/jsapi-util.c
+++ b/gjs/jsapi-util.c
@@ -481,7 +481,7 @@ gjs_explain_scope(JSContext *context,
g_string_append_printf(chain, "%p %s",
parent, debug);
g_free(debug);
- parent = JS_GetParent(context, parent);
+ parent = JS_GetParent(parent);
}
gjs_debug(GJS_DEBUG_SCOPE,
" Chain: %s",
diff --git a/modules/cairo-context.c b/modules/cairo-context.c
index 7453494..091275d 100644
--- a/modules/cairo-context.c
+++ b/modules/cairo-context.c
@@ -265,7 +265,7 @@ _gjs_cairo_context_construct_internal(JSContext *context,
priv = g_slice_new0(GjsCairoContext);
g_assert(priv_from_js(context, obj) == NULL);
- JS_SetPrivate(context, obj, priv);
+ JS_SetPrivate(obj, priv);
priv->context = context;
priv->object = obj;
diff --git a/modules/cairo-path.c b/modules/cairo-path.c
index de59641..48435fd 100644
--- a/modules/cairo-path.c
+++ b/modules/cairo-path.c
@@ -41,7 +41,7 @@ gjs_cairo_path_finalize(JSContext *context,
JSObject *obj)
{
GjsCairoPath *priv;
- priv = JS_GetPrivate(context, obj);
+ priv = JS_GetPrivate(obj);
if (priv == NULL)
return;
cairo_path_destroy(priv->path);
@@ -84,7 +84,7 @@ gjs_cairo_path_from_path(JSContext *context,
priv = g_slice_new0(GjsCairoPath);
g_assert(priv_from_js(context, object) == NULL);
- JS_SetPrivate(context, object, priv);
+ JS_SetPrivate(object, priv);
priv->context = context;
priv->object = object;
@@ -111,7 +111,7 @@ gjs_cairo_path_get_path(JSContext *context,
g_return_val_if_fail(context != NULL, NULL);
g_return_val_if_fail(object != NULL, NULL);
- priv = JS_GetPrivate(context, object);
+ priv = JS_GetPrivate(object);
if (priv == NULL)
return NULL;
return priv->path;
diff --git a/modules/cairo-pattern.c b/modules/cairo-pattern.c
index 98b64f2..cb52b24 100644
--- a/modules/cairo-pattern.c
+++ b/modules/cairo-pattern.c
@@ -42,7 +42,7 @@ gjs_cairo_pattern_finalize(JSContext *context,
JSObject *obj)
{
GjsCairoPattern *priv;
- priv = JS_GetPrivate(context, obj);
+ priv = JS_GetPrivate(obj);
if (priv == NULL)
return;
cairo_pattern_destroy(priv->pattern);
@@ -114,7 +114,7 @@ gjs_cairo_pattern_construct(JSContext *context,
priv = g_slice_new0(GjsCairoPattern);
g_assert(priv_from_js(context, object) == NULL);
- JS_SetPrivate(context, object, priv);
+ JS_SetPrivate(object, priv);
priv->context = context;
priv->object = object;
@@ -196,7 +196,7 @@ gjs_cairo_pattern_get_pattern(JSContext *context,
g_return_val_if_fail(context != NULL, NULL);
g_return_val_if_fail(object != NULL, NULL);
- priv = JS_GetPrivate(context, object);
+ priv = JS_GetPrivate(object);
if (priv == NULL)
return NULL;
diff --git a/modules/cairo-surface.c b/modules/cairo-surface.c
index 1d372df..5926930 100644
--- a/modules/cairo-surface.c
+++ b/modules/cairo-surface.c
@@ -42,7 +42,7 @@ gjs_cairo_surface_finalize(JSContext *context,
JSObject *obj)
{
GjsCairoSurface *priv;
- priv = JS_GetPrivate(context, obj);
+ priv = JS_GetPrivate(obj);
if (priv == NULL)
return;
cairo_surface_destroy(priv->surface);
@@ -152,7 +152,7 @@ gjs_cairo_surface_construct(JSContext *context,
priv = g_slice_new0(GjsCairoSurface);
g_assert(priv_from_js(context, object) == NULL);
- JS_SetPrivate(context, object, priv);
+ JS_SetPrivate(object, priv);
priv->context = context;
priv->object = object;
@@ -237,7 +237,7 @@ gjs_cairo_surface_get_surface(JSContext *context,
g_return_val_if_fail(context != NULL, NULL);
g_return_val_if_fail(object != NULL, NULL);
- priv = JS_GetPrivate(context, object);
+ priv = JS_GetPrivate(object);
if (priv == NULL)
return NULL;
return priv->surface;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]