[gjs] js: Don't cast JS::HandleObject to void *



commit 9fbf77bc357b7fd4cd8b59d99bd2d8982d30222a
Author: Philip Chimento <philip endlessm com>
Date:   Thu Sep 29 18:48:31 2016 -0700

    js: Don't cast JS::HandleObject to void *
    
    If we want the JSObject pointer in order to print it out, we should get
    it with .get().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742249

 gi/boxed.cpp       |    2 +-
 gi/fundamental.cpp |    2 +-
 gi/ns.cpp          |    2 +-
 gi/object.cpp      |    6 +++---
 gi/repo.cpp        |    2 +-
 gi/union.cpp       |    2 +-
 gjs/importer.cpp   |    4 ++--
 7 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index e2af668..87c6433 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -133,7 +133,7 @@ boxed_new_resolve(JSContext *context,
 
     priv = priv_from_js(context, obj);
     gjs_debug_jsprop(GJS_DEBUG_GBOXED, "Resolve prop '%s' hook obj %p priv %p",
-                     name, (void *)obj, priv);
+                     name, obj.get(), priv);
 
     if (priv == NULL)
         goto out; /* wrong class */
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index 8e4b1a2..36787e3 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -309,7 +309,7 @@ fundamental_instance_new_resolve(JSContext  *context,
     priv = priv_from_js(context, obj);
     gjs_debug_jsprop(GJS_DEBUG_GFUNDAMENTAL,
                      "Resolve prop '%s' hook obj %p priv %p",
-                     name, (void *)obj, priv);
+                     name, obj.get(), priv);
 
     if (priv == NULL)
         goto out; /* wrong class */
diff --git a/gi/ns.cpp b/gi/ns.cpp
index 2000fd8..22d5d71 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -82,7 +82,7 @@ ns_new_resolve(JSContext *context,
     priv = priv_from_js(context, obj);
     gjs_debug_jsprop(GJS_DEBUG_GNAMESPACE,
                      "Resolve prop '%s' hook obj %p priv %p",
-                     name, (void *)obj, priv);
+                     name, obj.get(), priv);
 
     if (priv == NULL) {
         ret = true; /* we are the prototype, or have the wrong class */
diff --git a/gi/object.cpp b/gi/object.cpp
index 4ad689d..2a0eacb 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -269,7 +269,7 @@ object_instance_get_prop(JSContext              *context,
     priv = priv_from_js(context, obj);
     gjs_debug_jsprop(GJS_DEBUG_GOBJECT,
                      "Get prop '%s' hook obj %p priv %p",
-                     name, (void *)obj, priv);
+                     name, obj.get(), priv);
 
     if (priv == NULL) {
         /* If we reach this point, either object_instance_new_resolve
@@ -338,7 +338,7 @@ object_instance_set_prop(JSContext              *context,
     priv = priv_from_js(context, obj);
     gjs_debug_jsprop(GJS_DEBUG_GOBJECT,
                      "Set prop '%s' hook obj %p priv %p",
-                     name, (void *)obj, priv);
+                     name, obj.get(), priv);
 
     if (priv == NULL) {
         /* see the comment in object_instance_get_prop() on this */
@@ -522,7 +522,7 @@ object_instance_new_resolve(JSContext *context,
     gjs_debug_jsprop(GJS_DEBUG_GOBJECT,
                      "Resolve prop '%s' hook obj %p priv %p (%s.%s) gobj %p %s",
                      name,
-                     (void *)obj,
+                     obj.get(),
                      priv,
                      priv && priv->info ? g_base_info_get_namespace (priv->info) : "",
                      priv && priv->info ? g_base_info_get_name (priv->info) : "",
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 2a15439..ce5afb0 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -191,7 +191,7 @@ repo_new_resolve(JSContext *context,
 
     priv = priv_from_js(context, obj);
     gjs_debug_jsprop(GJS_DEBUG_GREPO, "Resolve prop '%s' hook obj %p priv %p",
-                     name, (void *)obj, priv);
+                     name, obj.get(), priv);
 
     if (priv == NULL) /* we are the prototype, or have the wrong class */
         goto out;
diff --git a/gi/union.cpp b/gi/union.cpp
index 1506c58..7ffad0e 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -78,7 +78,7 @@ union_new_resolve(JSContext *context,
 
     priv = priv_from_js(context, obj);
     gjs_debug_jsprop(GJS_DEBUG_GBOXED, "Resolve prop '%s' hook obj %p priv %p",
-                     name, (void *)obj, priv);
+                     name, obj.get(), priv);
 
     if (priv == NULL) {
         ret = false; /* wrong class */
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index 9ecea53..845a294 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -870,7 +870,7 @@ importer_new_resolve(JSContext *context,
 
     gjs_debug_jsprop(GJS_DEBUG_IMPORTER,
                      "Resolve prop '%s' hook obj %p priv %p",
-                     name, (void *)obj, priv);
+                     name, obj.get(), priv);
     if (priv == NULL) /* we are the prototype, or have the wrong class */
         goto out;
     JS_BeginRequest(context);
@@ -1162,7 +1162,7 @@ gjs_define_root_importer_object(JSContext        *context,
                                NULL, NULL,
                                GJS_MODULE_PROP_FLAGS)) {
         gjs_debug(GJS_DEBUG_IMPORTER, "DefineProperty imports on %p failed",
-                  (JSObject *) in_object);
+                  in_object.get());
         goto fail;
     }
 


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