[gjs/wip/ptomato/mozjs45prep: 22/38] js: Switch from JS::NullPtr() to nullptr



commit 27b9eef8b1814840d3bf2bdc76380f1d79226035
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/gtype.cpp       |    2 +-
 gi/interface.cpp   |    4 +---
 gi/ns.cpp          |    2 +-
 gi/param.cpp       |    4 +---
 gi/repo.cpp        |    2 +-
 gi/union.cpp       |    3 +--
 gjs/byteArray.cpp  |    5 ++---
 gjs/context.cpp    |    2 +-
 gjs/importer.cpp   |    4 ++--
 gjs/jsapi-util.cpp |    2 +-
 modules/cairo.cpp  |   12 ++++--------
 13 files changed, 19 insertions(+), 29 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index c041f77..840e7f9 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -332,7 +332,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 634ea5d..9f6a12b 100644
--- a/gi/closure.cpp
+++ b/gi/closure.cpp
@@ -228,7 +228,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/gtype.cpp b/gi/gtype.cpp
index 61708e6..ac5b415 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -155,7 +155,7 @@ gjs_gtype_create_gtype_wrapper (JSContext *context,
     /* put constructor for GIRepositoryGType() in the global namespace */
     JS::RootedObject global(context, gjs_get_import_global(context));
     JS::RootedObject proto(context,
-        gjs_gtype_create_proto(context, global, "GIRepositoryGType", JS::NullPtr()).toObjectOrNull());
+        gjs_gtype_create_proto(context, global, "GIRepositoryGType", nullptr).toObjectOrNull());
 
     auto heap_wrapper =
         static_cast<JS::Heap<JSObject *> *>(g_type_get_qdata(gtype, gjs_get_gtype_wrapper_quark()));
diff --git a/gi/interface.cpp b/gi/interface.cpp
index cd4f9a7..b2d04b5 100644
--- a/gi/interface.cpp
+++ b/gi/interface.cpp
@@ -199,9 +199,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 124dd7e..0bf815e 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -197,7 +197,7 @@ ns_new(JSContext    *context,
                                   * prototype; NULL for
                                   * Object.prototype
                                   */
-                                 JS::NullPtr(),
+                                 nullptr,
                                  &gjs_ns_class,
                                  /* constructor for instances (NULL for
                                   * none - just name the prototype like
diff --git a/gi/param.cpp b/gi/param.cpp
index c80822a..b943992 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -210,9 +210,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 4ff17bb..cc3bc63 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -252,7 +252,7 @@ repo_new(JSContext *context)
                                   * prototype; NULL for
                                   * Object.prototype
                                   */
-                                 JS::NullPtr(),
+                                 nullptr,
                                  &gjs_repo_class,
                                  /* constructor for instances (NULL for
                                   * none - just name the prototype like
diff --git a/gi/union.cpp b/gi/union.cpp
index de708da..28c793d 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -340,8 +340,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/byteArray.cpp b/gjs/byteArray.cpp
index 81f4463..2167a14 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -516,7 +516,7 @@ byte_array_get_prototype(JSContext *context)
         gjs_get_global_slot(context, GJS_GLOBAL_SLOT_BYTE_ARRAY_PROTOTYPE));
 
     if (!retval.isObject()) {
-        if (!gjs_eval_with_scope(context, JS::NullPtr(),
+        if (!gjs_eval_with_scope(context, nullptr,
                                  "imports.byteArray.ByteArray.prototype;", -1,
                                  "<internal>", &retval))
             g_error ("Could not import byte array prototype\n");
@@ -850,8 +850,7 @@ gjs_define_byte_array_stuff(JSContext              *context,
 
     module.set(JS_NewPlainObject(context));
 
-    prototype = JS_InitClass(context, module, JS::NullPtr(),
-                             &gjs_byte_array_class,
+    prototype = JS_InitClass(context, module, nullptr, &gjs_byte_array_class,
                              gjs_byte_array_constructor,
                              0,
                              &gjs_byte_array_proto_props[0],
diff --git a/gjs/context.cpp b/gjs/context.cpp
index afd2340..43a04c1 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 6a62aa4..b68584a 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -917,7 +917,7 @@ importer_new(JSContext *context,
                                   * prototype; NULL for
                                   * Object.prototype
                                   */
-                                 JS::NullPtr(),
+                                 nullptr,
                                  js::Jsvalify(&gjs_importer_class),
                                  /* constructor for instances (NULL for
                                   * none - just name the prototype like
@@ -1108,7 +1108,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 b5667a6..164ea02 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -692,7 +692,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;
 
diff --git a/modules/cairo.cpp b/modules/cairo.cpp
index 973aa0d..ee2e26d 100644
--- a/modules/cairo.cpp
+++ b/modules/cairo.cpp
@@ -65,21 +65,18 @@ gjs_js_define_cairo_stuff(JSContext              *context,
 
     module.set(JS_NewPlainObject(context));
 
-    obj = gjs_cairo_region_create_proto(context, module,
-                                        "Region", JS::NullPtr());
+    obj = gjs_cairo_region_create_proto(context, module, "Region", nullptr);
     if (obj.isNull())
         return false;
     gjs_cairo_region_init(context);
 
-    obj = gjs_cairo_context_create_proto(context, module,
-                                         "Context", JS::NullPtr());
+    obj = gjs_cairo_context_create_proto(context, module, "Context", nullptr);
     if (obj.isNull())
         return false;
     gjs_cairo_context_init(context);
     gjs_cairo_surface_init(context);
 
-    obj = gjs_cairo_surface_create_proto(context, module,
-                                         "Surface", JS::NullPtr());
+    obj = gjs_cairo_surface_create_proto(context, module, "Surface", nullptr);
     if (obj.isNull())
         return false;
     surface_proto = &obj.toObject();
@@ -113,8 +110,7 @@ gjs_js_define_cairo_stuff(JSContext              *context,
         return false;
 #endif
 
-    obj = gjs_cairo_pattern_create_proto(context, module,
-                                         "Pattern", JS::NullPtr());
+    obj = gjs_cairo_pattern_create_proto(context, module, "Pattern", nullptr);
     if (obj.isNull())
         return false;
     pattern_proto = &obj.toObject();


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