[gjs: 7/11] boxed: Remove GIBoxedInfo typedef
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 7/11] boxed: Remove GIBoxedInfo typedef
- Date: Sun, 4 Nov 2018 18:00:28 +0000 (UTC)
commit 92e20de33d4b882b172db9edf78f4699dd923905
Author: Philip Chimento <philip chimento gmail com>
Date: Sat Nov 3 09:30:06 2018 -0400
boxed: Remove GIBoxedInfo typedef
It seems from the comment that this was added in expectation of a
GIBoxedInfo being added to gobject-introspection. After 10 years that is
unlikely to happen, so just remove the typedef and use GIStructInfo which
is the official API.
gi/boxed.cpp | 18 +++++++++---------
gi/boxed.h | 5 +----
gi/gerror.cpp | 5 ++---
3 files changed, 12 insertions(+), 16 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index bb05e0c8..ec43cb3b 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -49,7 +49,7 @@ struct Boxed {
js::DefaultHasher<JSString*>, js::SystemAllocPolicy>;
/* prototype info */
- GIBoxedInfo *info;
+ GIStructInfo* info;
GType gtype;
gint zero_args_constructor; /* -1 if none */
JS::Heap<jsid> zero_args_constructor_name;
@@ -570,9 +570,9 @@ get_nested_interface_object(JSContext *context,
return false;
}
- JS::RootedObject proto(context,
- gjs_lookup_generic_prototype(context,
- (GIBoxedInfo*) interface_info));
+ JS::RootedObject proto(
+ context, gjs_lookup_generic_prototype(context, interface_info));
+
if (!proto)
return false;
proto_priv = priv_from_js(context, proto);
@@ -588,7 +588,7 @@ get_nested_interface_object(JSContext *context,
priv = g_slice_new0(Boxed);
new (priv) Boxed();
JS_SetPrivate(obj, priv);
- priv->info = (GIBoxedInfo*) interface_info;
+ priv->info = interface_info;
g_base_info_ref( (GIBaseInfo*) priv->info);
priv->gtype = g_registered_type_info_get_g_type ((GIRegisteredTypeInfo*) interface_info);
priv->can_allocate_directly = proto_priv->can_allocate_directly;
@@ -694,9 +694,9 @@ set_nested_interface_object (JSContext *context,
return false;
}
- JS::RootedObject proto(context,
- gjs_lookup_generic_prototype(context,
- (GIBoxedInfo*) interface_info));
+ JS::RootedObject proto(
+ context, gjs_lookup_generic_prototype(context, interface_info));
+
if (!proto)
return false;
proto_priv = priv_from_js(context, proto);
@@ -1121,7 +1121,7 @@ boxed_fill_prototype_info(JSContext *context,
}
bool gjs_define_boxed_class(JSContext* context, JS::HandleObject in_object,
- GIBoxedInfo* info) {
+ GIStructInfo* info) {
const char *constructor_name;
JS::RootedObject prototype(context), constructor(context);
Boxed *priv;
diff --git a/gi/boxed.h b/gi/boxed.h
index c7f167a6..7d786c33 100644
--- a/gi/boxed.h
+++ b/gi/boxed.h
@@ -39,12 +39,9 @@ typedef enum {
GJS_BOXED_CREATION_NO_COPY = (1 << 0)
} GjsBoxedCreationFlags;
-/* Hack for now... why doesn't gobject-introspection have this? */
-typedef GIStructInfo GIBoxedInfo;
-
GJS_JSAPI_RETURN_CONVENTION
bool gjs_define_boxed_class(JSContext* cx, JS::HandleObject in_object,
- GIBoxedInfo* info);
+ GIStructInfo* info);
GJS_JSAPI_RETURN_CONVENTION
void* gjs_c_struct_from_boxed (JSContext *context,
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index 848fc0af..e87af80a 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -304,7 +304,6 @@ static JSFunctionSpec gjs_error_constructor_funcs[] = {
bool gjs_define_error_class(JSContext* context, JS::HandleObject in_object,
GIEnumInfo* info) {
const char *constructor_name;
- GIBoxedInfo *glib_error_info;
JS::RootedObject prototype(context), constructor(context);
Error *priv;
@@ -316,10 +315,10 @@ bool gjs_define_error_class(JSContext* context, JS::HandleObject in_object,
constructor_name = g_base_info_get_name( (GIBaseInfo*) info);
g_irepository_require(NULL, "GLib", "2.0", (GIRepositoryLoadFlags) 0, NULL);
- glib_error_info = (GIBoxedInfo*) g_irepository_find_by_name(NULL, "GLib", "Error");
+ GjsAutoStructInfo glib_error_info =
+ g_irepository_find_by_name(nullptr, "GLib", "Error");
JS::RootedObject parent_proto(context,
gjs_lookup_generic_prototype(context, glib_error_info));
- g_base_info_unref((GIBaseInfo*)glib_error_info);
if (!parent_proto ||
!gjs_init_class_dynamic(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]