[gjs: 3/16] object: Make gjs_object_associate_closure() infallible
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 3/16] object: Make gjs_object_associate_closure() infallible
- Date: Sat, 3 Nov 2018 02:41:29 +0000 (UTC)
commit ba32a07c4b7f05023485e7e5c7257285058f0196
Author: Philip Chimento <philip chimento gmail com>
Date: Sun Oct 28 16:54:36 2018 -0400
object: Make gjs_object_associate_closure() infallible
The underlying ObjectInstance method can't fail, so neither should this
one. It should just be a no-op when called on the wrong object. The return
value was also already ignored in all callers.
gi/object.cpp | 10 +++-------
gi/object.h | 5 ++---
2 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index f0c41401..8265cd2e 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -2530,15 +2530,11 @@ gjs_lookup_object_constructor(JSContext *context,
return true;
}
-bool
-gjs_object_associate_closure(JSContext *cx,
- JS::HandleObject object,
- GClosure *closure)
-{
+void gjs_object_associate_closure(JSContext* cx, JS::HandleObject object,
+ GClosure* closure) {
auto* priv = ObjectBase::for_js(cx, object);
if (!priv)
- return false;
+ return;
priv->associate_closure(cx, closure);
- return true;
}
diff --git a/gi/object.h b/gi/object.h
index 17e88435..74672d97 100644
--- a/gi/object.h
+++ b/gi/object.h
@@ -507,9 +507,8 @@ bool gjs_object_define_static_methods(JSContext *context,
GType gtype,
GIObjectInfo *object_info);
-bool gjs_object_associate_closure(JSContext *cx,
- JS::HandleObject obj,
- GClosure *closure);
+void gjs_object_associate_closure(JSContext* cx, JS::HandleObject obj,
+ GClosure* closure);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]