[gjs/wip/gcampax/70-arg-cache: 13/14] union: Use cached gtype instead of g_registered_type_info_get_g_type()
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/gcampax/70-arg-cache: 13/14] union: Use cached gtype instead of g_registered_type_info_get_g_type()
- Date: Sun, 19 Jul 2020 23:59:16 +0000 (UTC)
commit f460b0a267d7d062f893b894a4ebbf7e42314cb5
Author: Philip Chimento <philip chimento gmail com>
Date: Sat Jul 18 22:31:52 2020 -0700
union: Use cached gtype instead of g_registered_type_info_get_g_type()
After determining that g_registered_type_info_get_g_type() calls
g_module_symbol() while writing the previous commit, it makes sense to
remove calls to it where we do already have access to the GType. Here,
it is cached on UnionPrototype already.
gi/union.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/gi/union.cpp b/gi/union.cpp
index b2b2d834..5e6aa366 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -52,7 +52,7 @@ UnionInstance::UnionInstance(JSContext* cx, JS::HandleObject obj)
UnionInstance::~UnionInstance(void) {
if (m_ptr) {
- g_boxed_free(g_registered_type_info_get_g_type(info()), m_ptr);
+ g_boxed_free(gtype(), m_ptr);
m_ptr = nullptr;
}
GJS_DEC_COUNTER(union_instance);
@@ -76,9 +76,7 @@ bool UnionPrototype::resolve_impl(JSContext* context, JS::HandleObject obj,
method_info.name(), ns(), name());
/* obj is union proto */
- if (!gjs_define_function(context, obj,
- g_registered_type_info_get_g_type(info()),
- method_info))
+ if (!gjs_define_function(context, obj, gtype(), method_info))
return false;
*resolved = true; /* we defined the prop in object_proto */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]