[gjs/wip/ptomato/mozjs45: 10/25] js: Switch from JS::NullPtr() to nullptr



commit 78c87c9ff16d9b21ffa11f91c3280046a5a3217f
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 938c78b..6b4e261 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -333,7 +333,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());
 }
 
@@ -1159,7 +1159,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 712702b..00a87e7 100644
--- a/gi/interface.cpp
+++ b/gi/interface.cpp
@@ -200,9 +200,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 9406cd6..c892741 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -187,7 +187,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 c38eebb..c9a1ccd 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -211,9 +211,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 10fd465..c1f8450 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -251,7 +251,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 c4ef103..47f85f6 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -341,8 +341,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 2b506c2..24a615b 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -760,7 +760,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 c930eba..0ad7880 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -909,7 +909,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,
@@ -1079,7 +1079,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 900b1b4..8407174 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -693,7 +693,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]