[gjs/wip/ptomato/mozjs52: 6/33] js: Switch from JS::NullPtr() to nullptr



commit 61f1b577b9f8e23b2f9f79484658100849835d61
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Mar 19 05:00:48 2017 +0000

    js: Switch from JS::NullPtr() to nullptr
    
    JS::NullPtr() is gone, and instead now functions that took JS::NullPtr()
    as a null handle value take nullptr_t, so we should use C++ nullptr.

 gi/boxed.cpp       |    4 ++--
 gi/closure.cpp     |    2 +-
 gi/function.cpp    |    2 +-
 gi/gtype.cpp       |    5 ++---
 gi/interface.cpp   |    4 +---
 gi/ns.cpp          |    2 +-
 gi/param.cpp       |    4 +---
 gi/repo.cpp        |    2 +-
 gi/union.cpp       |    3 +--
 gjs/context.cpp    |    2 +-
 gjs/importer.cpp   |    4 ++--
 gjs/jsapi-util.cpp |    2 +-
 12 files changed, 15 insertions(+), 21 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index ecef36d..3f3a778 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -322,7 +322,7 @@ boxed_invoke_constructor(JSContext             *context,
                                      constructor_name, &js_constructor_func))
         return false;
 
-    return gjs_call_function_value(context, JS::NullPtr(), js_constructor_func,
+    return gjs_call_function_value(context, nullptr, js_constructor_func,
                                    args, args.rval());
 }
 
@@ -1148,7 +1148,7 @@ gjs_define_boxed_class(JSContext       *context,
     constructor_name = g_base_info_get_name( (GIBaseInfo*) info);
 
     if (!gjs_init_class_dynamic(context, in_object,
-                                JS::NullPtr(), /* parent prototype */
+                                nullptr, /* parent prototype */
                                 g_base_info_get_namespace( (GIBaseInfo*) info),
                                 constructor_name,
                                 &gjs_boxed_class,
diff --git a/gi/closure.cpp b/gi/closure.cpp
index e3ef0ba..b314ebb 100644
--- a/gi/closure.cpp
+++ b/gi/closure.cpp
@@ -225,7 +225,7 @@ gjs_closure_invoke(GClosure                   *closure,
     JS::RootedValue v_closure(context, JS::ObjectValue(*c->obj));
     if (!gjs_call_function_value(context,
                                  /* "this" object; null is some kind of default presumably */
-                                 JS::NullPtr(),
+                                 nullptr,
                                  v_closure, args, retval)) {
         /* Exception thrown... */
         gjs_debug_closure("Closure invocation failed (exception should "
diff --git a/gi/function.cpp b/gi/function.cpp
index e3a6c9f..94d9028 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -1678,7 +1678,7 @@ function_new(JSContext      *context,
     Function *priv;
 
     JS::RootedObject proto(context);
-    if (!gjs_function_define_proto(context, JS::NullPtr(), &proto))
+    if (!gjs_function_define_proto(context, nullptr, &proto))
         return nullptr;
 
     JS::RootedObject function(context,
diff --git a/gi/gtype.cpp b/gi/gtype.cpp
index d1d5669..4c19a3b 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -159,12 +159,11 @@ gjs_gtype_create_gtype_wrapper (JSContext *context,
         return *heap_wrapper;
 
     JS::RootedObject proto(context);
-    if (!gjs_gtype_define_proto(context, JS::NullPtr(), &proto))
+    if (!gjs_gtype_define_proto(context, nullptr, &proto))
         return nullptr;
 
     heap_wrapper = new JS::Heap<JSObject *>();
-    *heap_wrapper = JS_NewObjectWithGivenProto(context, &gjs_gtype_class, proto,
-                                               JS::NullPtr());
+    *heap_wrapper = JS_NewObjectWithGivenProto(context, &gjs_gtype_class, proto);
     if (*heap_wrapper == nullptr)
         return nullptr;
 
diff --git a/gi/interface.cpp b/gi/interface.cpp
index c9c8573..37a94bd 100644
--- a/gi/interface.cpp
+++ b/gi/interface.cpp
@@ -195,9 +195,7 @@ gjs_define_interface_class(JSContext              *context,
     ns = gjs_get_names_from_gtype_and_gi_info(gtype, (GIBaseInfo *) info,
                                               &constructor_name);
 
-    if (!gjs_init_class_dynamic(context, in_object,
-                                JS::NullPtr(),
-                                ns,
+    if (!gjs_init_class_dynamic(context, in_object, nullptr, ns,
                                 constructor_name,
                                 &gjs_interface_class,
                                 gjs_interface_constructor, 0,
diff --git a/gi/ns.cpp b/gi/ns.cpp
index 830e4e9..bfb1bf8 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -182,7 +182,7 @@ ns_new(JSContext    *context,
     Ns *priv;
 
     JS::RootedObject proto(context);
-    if (!gjs_ns_define_proto(context, JS::NullPtr(), &proto))
+    if (!gjs_ns_define_proto(context, nullptr, &proto))
         return nullptr;
 
     JS::RootedObject ns(context,
diff --git a/gi/param.cpp b/gi/param.cpp
index 6fe1c06..84192a3 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -209,9 +209,7 @@ gjs_define_param_class(JSContext       *context,
 
     constructor_name = "ParamSpec";
 
-    if (!gjs_init_class_dynamic(context, in_object,
-                                JS::NullPtr(),
-                                "GObject",
+    if (!gjs_init_class_dynamic(context, in_object, nullptr, "GObject",
                                 constructor_name,
                                 &gjs_param_class,
                                 gjs_param_constructor, 0,
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 6102c58..f828fb6 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -247,7 +247,7 @@ repo_new(JSContext *context)
     Repo *priv;
 
     JS::RootedObject proto(context);
-    if (!gjs_repo_define_proto(context, JS::NullPtr(), &proto))
+    if (!gjs_repo_define_proto(context, nullptr, &proto))
         return nullptr;
 
     JS::RootedObject repo(context,
diff --git a/gi/union.cpp b/gi/union.cpp
index c18e367..feda07a 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -336,8 +336,7 @@ gjs_define_union_class(JSContext       *context,
 
     constructor_name = g_base_info_get_name( (GIBaseInfo*) info);
 
-    if (!gjs_init_class_dynamic(context, in_object,
-                                JS::NullPtr(),
+    if (!gjs_init_class_dynamic(context, in_object, nullptr,
                                 g_base_info_get_namespace( (GIBaseInfo*) info),
                                 constructor_name,
                                 &gjs_union_class,
diff --git a/gjs/context.cpp b/gjs/context.cpp
index ca8d43d..27e1b81 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -757,7 +757,7 @@ gjs_context_eval(GjsContext   *js_context,
     g_object_ref(G_OBJECT(js_context));
 
     JS::RootedValue retval(js_context->context);
-    if (!gjs_eval_with_scope(js_context->context, JS::NullPtr(), script,
+    if (!gjs_eval_with_scope(js_context->context, nullptr, script,
                              script_len, filename, &retval)) {
         uint8_t code;
         if (_gjs_context_should_exit(js_context, &code)) {
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index 7d2c433..0f546fe 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -897,7 +897,7 @@ importer_new(JSContext *context,
     Importer *priv;
 
     JS::RootedObject proto(context);
-    if (!gjs_importer_define_proto(context, JS::NullPtr(), &proto))
+    if (!gjs_importer_define_proto(context, nullptr, &proto))
         g_error("Error creating importer prototype");
 
     JS::RootedObject importer(context,
@@ -1067,7 +1067,7 @@ gjs_create_root_importer(JSContext   *context,
     importer = JS::ObjectValue(*gjs_create_importer(context, "imports",
                                                     initial_search_path,
                                                     add_standard_search_path,
-                                                    true, JS::NullPtr()));
+                                                    true, nullptr));
     gjs_set_global_slot(context, GJS_GLOBAL_SLOT_IMPORTS, importer);
 
     JS_EndRequest(context);
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 7c7de73..617836a 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -688,7 +688,7 @@ gjs_log_exception(JSContext  *context)
 
     JS_ClearPendingException(context);
 
-    gjs_log_exception_full(context, exc, JS::NullPtr());
+    gjs_log_exception_full(context, exc, nullptr);
 
     retval = true;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]