[gjs/wip/ptomato/mozjs31: 9/21] js: Pass JS::NullPtr() instead of NULL
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs31: 9/21] js: Pass JS::NullPtr() instead of NULL
- Date: Mon, 7 Nov 2016 21:18:10 +0000 (UTC)
commit 6332260b3540d593eb954aad8da8a02eb667bd08
Author: Philip Chimento <philip endlessm com>
Date: Thu Nov 3 18:28:12 2016 -0700
js: Pass JS::NullPtr() instead of NULL
In APIs that now take a JS::HandleObject, we must pass JS::NullPtr()
since JS::HandleObject cannot directly be constructed from NULL.
gi/arg.cpp | 3 ++-
gi/enumeration.cpp | 2 +-
gi/function.cpp | 2 +-
gi/gtype.cpp | 2 +-
gi/keep-alive.cpp | 4 ++--
gi/ns.cpp | 5 +++--
gi/object.cpp | 4 ++--
gi/repo.cpp | 9 +++++----
gjs/byteArray.cpp | 9 ++++-----
gjs/importer.cpp | 8 ++++----
gjs/jsapi-util.cpp | 2 +-
modules/cairo-context.cpp | 2 +-
modules/cairo-image-surface.cpp | 4 ++--
modules/cairo-linear-gradient.cpp | 2 +-
modules/cairo-path.cpp | 2 +-
modules/cairo-pdf-surface.cpp | 2 +-
modules/cairo-ps-surface.cpp | 2 +-
modules/cairo-radial-gradient.cpp | 2 +-
modules/cairo-region.cpp | 4 ++--
modules/cairo-solid-pattern.cpp | 2 +-
modules/cairo-surface-pattern.cpp | 2 +-
modules/cairo-surface.cpp | 2 +-
modules/cairo-svg-surface.cpp | 2 +-
modules/cairo.cpp | 2 +-
modules/console.cpp | 2 +-
modules/system.cpp | 2 +-
26 files changed, 43 insertions(+), 41 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index e21c2c8..5e3f4ae 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -2535,7 +2535,8 @@ gjs_object_from_g_hash (JSContext *context,
return true;
}
- JS::RootedObject obj(context, JS_NewObject(context, NULL, NULL, NULL));
+ JS::RootedObject obj(context,
+ JS_NewObject(context, NULL, JS::NullPtr(), JS::NullPtr()));
if (obj == NULL)
return false;
diff --git a/gi/enumeration.cpp b/gi/enumeration.cpp
index 1b2361c..f4b901e 100644
--- a/gi/enumeration.cpp
+++ b/gi/enumeration.cpp
@@ -168,7 +168,7 @@ gjs_define_enumeration(JSContext *context,
enum_name = g_base_info_get_name( (GIBaseInfo*) info);
- JS::RootedObject enum_obj(context, JS_NewObject(context, NULL, NULL,
+ JS::RootedObject enum_obj(context, JS_NewObject(context, NULL, JS::NullPtr(),
global));
if (enum_obj == NULL) {
g_error("Could not create enumeration %s.%s",
diff --git a/gi/function.cpp b/gi/function.cpp
index c2c76e0..8c50f71 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -1693,7 +1693,7 @@ function_new(JSContext *context,
}
JS::RootedObject function(context,
- JS_NewObject(context, &gjs_function_class, NULL, global));
+ JS_NewObject(context, &gjs_function_class, JS::NullPtr(), global));
if (function == NULL) {
gjs_debug(GJS_DEBUG_GFUNCTION, "Failed to construct function");
return NULL;
diff --git a/gi/gtype.cpp b/gi/gtype.cpp
index 401e8fb..35e287f 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -132,7 +132,7 @@ gjs_gtype_create_gtype_wrapper (JSContext *context,
if (object != NULL)
goto out;
- object = JS_NewObject(context, &gjs_gtype_class, NULL, NULL);
+ object = JS_NewObject(context, &gjs_gtype_class, JS::NullPtr(), JS::NullPtr());
if (object == NULL)
goto out;
diff --git a/gi/keep-alive.cpp b/gi/keep-alive.cpp
index 78bc23c..4021622 100644
--- a/gi/keep-alive.cpp
+++ b/gi/keep-alive.cpp
@@ -207,7 +207,7 @@ gjs_keep_alive_new(JSContext *context)
* prototype; NULL for
* Object.prototype
*/
- NULL,
+ JS::NullPtr(),
&gjs_keep_alive_class,
/* constructor for instances (NULL for
* none - just name the prototype like
@@ -236,7 +236,7 @@ gjs_keep_alive_new(JSContext *context)
context, global.get());
JS::RootedObject keep_alive(context,
- JS_NewObject(context, &gjs_keep_alive_class, NULL, global));
+ JS_NewObject(context, &gjs_keep_alive_class, JS::NullPtr(), global));
if (keep_alive == NULL) {
gjs_log_exception(context);
g_error("Failed to create keep_alive object");
diff --git a/gi/ns.cpp b/gi/ns.cpp
index a6b99c8..172bc7c 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -207,7 +207,7 @@ ns_new(JSContext *context,
* prototype; NULL for
* Object.prototype
*/
- NULL,
+ JS::NullPtr(),
&gjs_ns_class,
/* constructor for instances (NULL for
* none - just name the prototype like
@@ -231,7 +231,8 @@ ns_new(JSContext *context,
gjs_ns_class.name, prototype);
}
- JS::RootedObject ns(context, JS_NewObject(context, &gjs_ns_class, NULL, global));
+ JS::RootedObject ns(context, JS_NewObject(context, &gjs_ns_class,
+ JS::NullPtr(), global));
if (ns == NULL)
g_error("No memory to create ns object");
diff --git a/gi/object.cpp b/gi/object.cpp
index 276697e..ab8adce 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -2424,7 +2424,7 @@ gjs_object_constructor (GType type,
guint i;
JS::RootedObject props_hash(context,
- JS_NewObject(context, NULL, NULL, NULL));
+ JS_NewObject(context, NULL, JS::NullPtr(), JS::NullPtr()));
for (i = 0; i < n_construct_properties; i++)
jsobj_set_gproperty(context, props_hash,
@@ -3013,7 +3013,7 @@ bool
gjs_define_private_gi_stuff(JSContext *cx,
JS::MutableHandleObject module)
{
- module.set(JS_NewObject(cx, NULL, NULL, NULL));
+ module.set(JS_NewObject(cx, NULL, JS::NullPtr(), JS::NullPtr()));
return JS_DefineFunctions(cx, module, &module_funcs[0]);
}
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 240c6c6..f193581 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -258,7 +258,7 @@ repo_new(JSContext *context)
* prototype; NULL for
* Object.prototype
*/
- NULL,
+ JS::NullPtr(),
&gjs_repo_class,
/* constructor for instances (NULL for
* none - just name the prototype like
@@ -282,7 +282,8 @@ repo_new(JSContext *context)
gjs_repo_class.name, prototype);
}
- JS::RootedObject repo(context, JS_NewObject(context, &gjs_repo_class, NULL, global));
+ JS::RootedObject repo(context,
+ JS_NewObject(context, &gjs_repo_class, JS::NullPtr(), global));
if (repo == NULL) {
gjs_throw(context, "No memory to create repo object");
return NULL;
@@ -298,7 +299,7 @@ repo_new(JSContext *context)
gjs_debug_lifecycle(GJS_DEBUG_GREPO,
"repo constructor, obj %p priv %p", repo.get(), priv);
- versions = JS_NewObject(context, NULL, NULL, global);
+ versions = JS_NewObject(context, NULL, JS::NullPtr(), global);
versions_name = gjs_context_get_const_string(context, GJS_STRING_GI_VERSIONS);
JS_DefinePropertyById(context, repo,
versions_name,
@@ -306,7 +307,7 @@ repo_new(JSContext *context)
NULL, NULL,
JSPROP_PERMANENT);
- private_ns = JS_NewObject(context, NULL, NULL, global);
+ private_ns = JS_NewObject(context, NULL, JS::NullPtr(), global);
private_ns_name = gjs_context_get_const_string(context, GJS_STRING_PRIVATE_NS_MARKER);
JS_DefinePropertyById(context, repo,
private_ns_name,
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index 1d82302..a574382 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -534,7 +534,7 @@ byte_array_new(JSContext *context)
JS::RootedObject proto(context, byte_array_get_prototype(context));
JS::RootedObject array(context,
- JS_NewObject(context, &gjs_byte_array_class, proto, NULL));
+ JS_NewObject(context, &gjs_byte_array_class, proto, JS::NullPtr()));
priv = g_slice_new0(ByteArrayInstance);
@@ -744,7 +744,7 @@ gjs_byte_array_from_byte_array (JSContext *context,
JS::RootedObject proto(context, byte_array_get_prototype(context));
JS::RootedObject object(context,
- JS_NewObject(context, &gjs_byte_array_class, proto, NULL));
+ JS_NewObject(context, &gjs_byte_array_class, proto, JS::NullPtr()));
if (!object) {
gjs_throw(context, "failed to create byte array");
@@ -832,10 +832,9 @@ gjs_define_byte_array_stuff(JSContext *context,
{
JSObject *prototype;
- module.set(JS_NewObject(context, NULL, NULL, NULL));
+ module.set(JS_NewObject(context, NULL, JS::NullPtr(), JS::NullPtr()));
- prototype = JS_InitClass(context, module,
- NULL,
+ prototype = JS_InitClass(context, module, JS::NullPtr(),
&gjs_byte_array_class,
gjs_byte_array_constructor,
0,
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index b3416e5..f0ff510 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -248,13 +248,13 @@ import_native_file(JSContext *context,
JS::RootedValue v_module(context, JS::ObjectValue(*module_obj));
return JS_DefineProperty(context, obj, name, v_module,
- NULL, NULL, GJS_MODULE_PROP_FLAGS);
+ GJS_MODULE_PROP_FLAGS);
}
static JSObject *
create_module_object(JSContext *context)
{
- return JS_NewObject(context, NULL, NULL, NULL);
+ return JS_NewObject(context, NULL, JS::NullPtr(), JS::NullPtr());
}
static bool
@@ -934,7 +934,7 @@ importer_new(JSContext *context,
* prototype; NULL for
* Object.prototype
*/
- NULL,
+ JS::NullPtr(),
&gjs_importer_class,
/* constructor for instances (NULL for
* none - just name the prototype like
@@ -959,7 +959,7 @@ importer_new(JSContext *context,
}
JS::RootedObject importer(context,
- JS_NewObject(context, &gjs_importer_class, NULL, global));
+ JS_NewObject(context, &gjs_importer_class, JS::NullPtr(), global));
if (importer == NULL)
g_error("No memory to create importer importer");
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index c1ddf9d..0e4ca99 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -858,7 +858,7 @@ gjs_eval_with_scope(JSContext *context,
JS::RootedObject eval_obj(context, object);
if (!eval_obj)
- eval_obj = JS_NewObject(context, NULL, NULL, NULL);
+ eval_obj = JS_NewObject(context, NULL, JS::NullPtr(), JS::NullPtr());
JS::CompileOptions options(context);
options.setUTF8(true)
diff --git a/modules/cairo-context.cpp b/modules/cairo-context.cpp
index 9338711..cf5efa5 100644
--- a/modules/cairo-context.cpp
+++ b/modules/cairo-context.cpp
@@ -923,7 +923,7 @@ gjs_cairo_context_from_context(JSContext *context,
cairo_t *cr)
{
JS::RootedObject object(context,
- JS_NewObject(context, &gjs_cairo_context_class, NULL, NULL));
+ JS_NewObject(context, &gjs_cairo_context_class, JS::NullPtr(), JS::NullPtr()));
if (!object)
return NULL;
diff --git a/modules/cairo-image-surface.cpp b/modules/cairo-image-surface.cpp
index c35ebc6..2af2d79 100644
--- a/modules/cairo-image-surface.cpp
+++ b/modules/cairo-image-surface.cpp
@@ -88,7 +88,7 @@ createFromPNG_func(JSContext *context,
return false;
JS::RootedObject surface_wrapper(context,
- JS_NewObject(context, &gjs_cairo_image_surface_class, NULL, NULL));
+ JS_NewObject(context, &gjs_cairo_image_surface_class, JS::NullPtr(), JS::NullPtr()));
if (!surface_wrapper) {
gjs_throw(context, "failed to create surface");
return false;
@@ -215,7 +215,7 @@ gjs_cairo_image_surface_from_surface(JSContext *context,
g_return_val_if_fail(cairo_surface_get_type(surface) == CAIRO_SURFACE_TYPE_IMAGE, NULL);
JS::RootedObject object(context,
- JS_NewObject(context, &gjs_cairo_image_surface_class, NULL, NULL));
+ JS_NewObject(context, &gjs_cairo_image_surface_class, JS::NullPtr(), JS::NullPtr()));
if (!object) {
gjs_throw(context, "failed to create image surface");
return NULL;
diff --git a/modules/cairo-linear-gradient.cpp b/modules/cairo-linear-gradient.cpp
index 4b6156d..3c0b866 100644
--- a/modules/cairo-linear-gradient.cpp
+++ b/modules/cairo-linear-gradient.cpp
@@ -82,7 +82,7 @@ gjs_cairo_linear_gradient_from_pattern(JSContext *context,
g_return_val_if_fail(cairo_pattern_get_type(pattern) == CAIRO_PATTERN_TYPE_LINEAR, NULL);
JS::RootedObject object(context,
- JS_NewObject(context, &gjs_cairo_linear_gradient_class, NULL, NULL));
+ JS_NewObject(context, &gjs_cairo_linear_gradient_class, JS::NullPtr(), JS::NullPtr()));
if (!object) {
gjs_throw(context, "failed to create linear gradient pattern");
return NULL;
diff --git a/modules/cairo-path.cpp b/modules/cairo-path.cpp
index 0ec2123..c4c0aed 100644
--- a/modules/cairo-path.cpp
+++ b/modules/cairo-path.cpp
@@ -75,7 +75,7 @@ gjs_cairo_path_from_path(JSContext *context,
g_return_val_if_fail(path != NULL, NULL);
JS::RootedObject object(context,
- JS_NewObject(context, &gjs_cairo_path_class, NULL, NULL));
+ JS_NewObject(context, &gjs_cairo_path_class, JS::NullPtr(), JS::NullPtr()));
if (!object) {
gjs_throw(context, "failed to create path");
return NULL;
diff --git a/modules/cairo-pdf-surface.cpp b/modules/cairo-pdf-surface.cpp
index e1abdf7..2e68a64 100644
--- a/modules/cairo-pdf-surface.cpp
+++ b/modules/cairo-pdf-surface.cpp
@@ -88,7 +88,7 @@ gjs_cairo_pdf_surface_from_surface(JSContext *context,
g_return_val_if_fail(cairo_surface_get_type(surface) == CAIRO_SURFACE_TYPE_PDF, NULL);
JS::RootedObject object(context,
- JS_NewObject(context, &gjs_cairo_pdf_surface_class, NULL, NULL));
+ JS_NewObject(context, &gjs_cairo_pdf_surface_class, JS::NullPtr(), JS::NullPtr()));
if (!object) {
gjs_throw(context, "failed to create pdf surface");
return NULL;
diff --git a/modules/cairo-ps-surface.cpp b/modules/cairo-ps-surface.cpp
index 097f248..270c73d 100644
--- a/modules/cairo-ps-surface.cpp
+++ b/modules/cairo-ps-surface.cpp
@@ -97,7 +97,7 @@ gjs_cairo_ps_surface_from_surface(JSContext *context,
g_return_val_if_fail(cairo_surface_get_type(surface) == CAIRO_SURFACE_TYPE_PS, NULL);
JS::RootedObject object(context,
- JS_NewObject(context, &gjs_cairo_ps_surface_class, NULL, NULL));
+ JS_NewObject(context, &gjs_cairo_ps_surface_class, JS::NullPtr(), JS::NullPtr()));
if (!object) {
gjs_throw(context, "failed to create ps surface");
return NULL;
diff --git a/modules/cairo-radial-gradient.cpp b/modules/cairo-radial-gradient.cpp
index 8952f59..f93ff29 100644
--- a/modules/cairo-radial-gradient.cpp
+++ b/modules/cairo-radial-gradient.cpp
@@ -84,7 +84,7 @@ gjs_cairo_radial_gradient_from_pattern(JSContext *context,
g_return_val_if_fail(cairo_pattern_get_type(pattern) == CAIRO_PATTERN_TYPE_RADIAL, NULL);
JS::RootedObject object(context,
- JS_NewObject(context, &gjs_cairo_radial_gradient_class, NULL, NULL));
+ JS_NewObject(context, &gjs_cairo_radial_gradient_class, JS::NullPtr(), JS::NullPtr()));
if (!object) {
gjs_throw(context, "failed to create radial gradient pattern");
return NULL;
diff --git a/modules/cairo-region.cpp b/modules/cairo-region.cpp
index 8e3571a..39ff07e 100644
--- a/modules/cairo-region.cpp
+++ b/modules/cairo-region.cpp
@@ -148,7 +148,7 @@ make_rectangle(JSContext *context,
cairo_rectangle_int_t *rect)
{
JS::RootedObject rect_obj(context,
- JS_NewObject(context, NULL, NULL, NULL));
+ JS_NewObject(context, NULL, JS::NullPtr(), JS::NullPtr()));
JS::RootedValue val(context);
val = JS::Int32Value(rect->x);
@@ -278,7 +278,7 @@ gjs_cairo_region_from_region(JSContext *context,
cairo_region_t *region)
{
JS::RootedObject object(context,
- JS_NewObject(context, &gjs_cairo_region_class, NULL, NULL));
+ JS_NewObject(context, &gjs_cairo_region_class, JS::NullPtr(), JS::NullPtr()));
if (!object)
return NULL;
diff --git a/modules/cairo-solid-pattern.cpp b/modules/cairo-solid-pattern.cpp
index bfab26b..9d994b8 100644
--- a/modules/cairo-solid-pattern.cpp
+++ b/modules/cairo-solid-pattern.cpp
@@ -112,7 +112,7 @@ gjs_cairo_solid_pattern_from_pattern(JSContext *context,
g_return_val_if_fail(cairo_pattern_get_type(pattern) == CAIRO_PATTERN_TYPE_SOLID, NULL);
JS::RootedObject object(context,
- JS_NewObject(context, &gjs_cairo_solid_pattern_class, NULL, NULL));
+ JS_NewObject(context, &gjs_cairo_solid_pattern_class, JS::NullPtr(), JS::NullPtr()));
if (!object) {
gjs_throw(context, "failed to create solid pattern");
return NULL;
diff --git a/modules/cairo-surface-pattern.cpp b/modules/cairo-surface-pattern.cpp
index 136f348..43ba99e 100644
--- a/modules/cairo-surface-pattern.cpp
+++ b/modules/cairo-surface-pattern.cpp
@@ -187,7 +187,7 @@ gjs_cairo_surface_pattern_from_pattern(JSContext *context,
g_return_val_if_fail(cairo_pattern_get_type(pattern) == CAIRO_PATTERN_TYPE_SURFACE, NULL);
JS::RootedObject object(context,
- JS_NewObject(context, &gjs_cairo_surface_pattern_class, NULL, NULL));
+ JS_NewObject(context, &gjs_cairo_surface_pattern_class, JS::NullPtr(), JS::NullPtr()));
if (!object) {
gjs_throw(context, "failed to create surface pattern");
return NULL;
diff --git a/modules/cairo-surface.cpp b/modules/cairo-surface.cpp
index 7288032..1bfdb73 100644
--- a/modules/cairo-surface.cpp
+++ b/modules/cairo-surface.cpp
@@ -206,7 +206,7 @@ gjs_cairo_surface_from_surface(JSContext *context,
return gjs_cairo_svg_surface_from_surface(context, surface);
JS::RootedObject object(context,
- JS_NewObject(context, &gjs_cairo_surface_class, NULL, NULL));
+ JS_NewObject(context, &gjs_cairo_surface_class, JS::NullPtr(), JS::NullPtr()));
if (!object) {
gjs_throw(context, "failed to create surface");
return NULL;
diff --git a/modules/cairo-svg-surface.cpp b/modules/cairo-svg-surface.cpp
index d2779c3..f18ee0f 100644
--- a/modules/cairo-svg-surface.cpp
+++ b/modules/cairo-svg-surface.cpp
@@ -88,7 +88,7 @@ gjs_cairo_svg_surface_from_surface(JSContext *context,
g_return_val_if_fail(cairo_surface_get_type(surface) == CAIRO_SURFACE_TYPE_SVG, NULL);
JS::RootedObject object(context,
- JS_NewObject(context, &gjs_cairo_svg_surface_class, NULL, NULL));
+ JS_NewObject(context, &gjs_cairo_svg_surface_class, JS::NullPtr(), JS::NullPtr()));
if (!object) {
gjs_throw(context, "failed to create svg surface");
return NULL;
diff --git a/modules/cairo.cpp b/modules/cairo.cpp
index 2114a17..15fadae 100644
--- a/modules/cairo.cpp
+++ b/modules/cairo.cpp
@@ -63,7 +63,7 @@ gjs_js_define_cairo_stuff(JSContext *context,
JS::RootedObject surface_proto(context), pattern_proto(context),
gradient_proto(context);
- module.set(JS_NewObject(context, NULL, NULL, NULL));
+ module.set(JS_NewObject(context, NULL, JS::NullPtr(), JS::NullPtr()));
obj = gjs_cairo_region_create_proto(context, module,
"Region", JS::NullPtr());
diff --git a/modules/console.cpp b/modules/console.cpp
index c2cf814..a15cbbc 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -233,7 +233,7 @@ bool
gjs_define_console_stuff(JSContext *context,
JS::MutableHandleObject module)
{
- module.set(JS_NewObject(context, NULL, NULL, NULL));
+ module.set(JS_NewObject(context, NULL, JS::NullPtr(), JS::NullPtr()));
return JS_DefineFunction(context, module, "interact", gjs_console_interact,
1, GJS_MODULE_PROP_FLAGS);
}
diff --git a/modules/system.cpp b/modules/system.cpp
index 37faef5..462bfdd 100644
--- a/modules/system.cpp
+++ b/modules/system.cpp
@@ -157,7 +157,7 @@ gjs_js_define_system_stuff(JSContext *context,
char *program_name;
bool retval;
- module.set(JS_NewObject(context, NULL, NULL, NULL));
+ module.set(JS_NewObject(context, NULL, JS::NullPtr(), JS::NullPtr()));
if (!JS_DefineFunctions(context, module, &module_funcs[0]))
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]