From 3f4529c51c5df431114b447a35a52917946c72fc Mon Sep 17 00:00:00 2001 From: DarkTrick Date: Fri, 16 Jul 2021 01:28:43 +0000 Subject: [PATCH 01/10] @g_boxed_type_register_static: added reference to G_DEFINE_BOXED_TYPE --- gobject/gboxed.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gobject/gboxed.c b/gobject/gboxed.c index ae48df5661..ae22fcbbd7 100644 --- a/gobject/gboxed.c +++ b/gobject/gboxed.c @@ -283,6 +283,11 @@ boxed_proxy_lcopy_value (const GValue *value, * boxed type with name @name. Boxed type handling functions have to be * provided to copy and free opaque boxed structures of this type. * + * For the general case, it is recommended to use %G_DEFINE_BOXED_TYPE + * instead of calling g_boxed_type_register_static directly. The macro + * will resolve the problem of a having to initialize a global variable + * containing the %GType. + * * Returns: New %G_TYPE_BOXED derived type id for @name. */ GType -- GitLab From 302b6054b139c8bb92f1fa2a7bcd42a7e4dd1ba1 Mon Sep 17 00:00:00 2001 From: DarkTrick Date: Fri, 16 Jul 2021 01:52:35 +0000 Subject: [PATCH 02/10] G_DEFINE_BOXED_TYPE: Added more information and example --- gobject/gtype.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gobject/gtype.h b/gobject/gtype.h index 5f97669787..21c7a49049 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -2071,8 +2071,24 @@ type_name##_get_type (void) \ * @copy_func: the #GBoxedCopyFunc for the new type * @free_func: the #GBoxedFreeFunc for the new type * - * A convenience macro for boxed type implementations, which defines a - * type_name_get_type() function registering the boxed type. + * A convenience macro for defining a new custom boxed type. + * + * Using this macro is the recommended way of defining new custom boxed + * types, over calling %g_boxed_type_register_static directly. It defines + * `type_name_get_type()` function which will return the newly defined + * %GType, implemented as lazy instantiation. + * + * |[ + * G_DEFINE_BOXED_TYPE (MyStruct, my_struct, my_struct_copy, my_struct_free) + * + * void + * foo() + * { + * GType type = my_struct_get_type(); + * // ... your code ... + * } + * + * ]| * * Since: 2.26 */ -- GitLab From 9ba5b4fbb9d09e89ca96c82d9422328d4b6ffa4d Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 22 Jul 2021 04:19:56 +0000 Subject: [PATCH 03/10] Apply 1 suggestion(s) to 1 file(s) --- gobject/gboxed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gobject/gboxed.c b/gobject/gboxed.c index ae22fcbbd7..e6c22a4981 100644 --- a/gobject/gboxed.c +++ b/gobject/gboxed.c @@ -283,7 +283,7 @@ boxed_proxy_lcopy_value (const GValue *value, * boxed type with name @name. Boxed type handling functions have to be * provided to copy and free opaque boxed structures of this type. * - * For the general case, it is recommended to use %G_DEFINE_BOXED_TYPE + * For the general case, it is recommended to use #G_DEFINE_BOXED_TYPE * instead of calling g_boxed_type_register_static directly. The macro * will resolve the problem of a having to initialize a global variable * containing the %GType. -- GitLab From 0ea5a08b7a7055fe6a9d7a68a81a6add2e4e53b2 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 22 Jul 2021 04:21:03 +0000 Subject: [PATCH 04/10] Apply 1 suggestion(s) to 1 file(s) --- gobject/gboxed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gobject/gboxed.c b/gobject/gboxed.c index e6c22a4981..71073ad696 100644 --- a/gobject/gboxed.c +++ b/gobject/gboxed.c @@ -284,7 +284,7 @@ boxed_proxy_lcopy_value (const GValue *value, * provided to copy and free opaque boxed structures of this type. * * For the general case, it is recommended to use #G_DEFINE_BOXED_TYPE - * instead of calling g_boxed_type_register_static directly. The macro + * instead of calling g_boxed_type_register_static() directly. The macro * will resolve the problem of a having to initialize a global variable * containing the %GType. * -- GitLab From e9e6e463a72f546e7c132003941929385b76118e Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 22 Jul 2021 04:32:36 +0000 Subject: [PATCH 05/10] Apply 1 suggestion(s) to 1 file(s) --- gobject/gtype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gobject/gtype.h b/gobject/gtype.h index 21c7a49049..6f370e4a6a 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -2074,7 +2074,7 @@ type_name##_get_type (void) \ * A convenience macro for defining a new custom boxed type. * * Using this macro is the recommended way of defining new custom boxed - * types, over calling %g_boxed_type_register_static directly. It defines + * types, over calling g_boxed_type_register_static() directly. It defines * `type_name_get_type()` function which will return the newly defined * %GType, implemented as lazy instantiation. * -- GitLab From 6d3d651384aeb774dc212f6e038926ec664dad8d Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 22 Jul 2021 04:32:53 +0000 Subject: [PATCH 06/10] Apply 1 suggestion(s) to 1 file(s) --- gobject/gtype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gobject/gtype.h b/gobject/gtype.h index 6f370e4a6a..56bbbd451a 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -2075,7 +2075,7 @@ type_name##_get_type (void) \ * * Using this macro is the recommended way of defining new custom boxed * types, over calling g_boxed_type_register_static() directly. It defines - * `type_name_get_type()` function which will return the newly defined + * a `type_name_get_type()` function which will return the newly defined * %GType, implemented as lazy instantiation. * * |[ -- GitLab From f8cba89f23555ee141a7df74edaa4663f1503cf9 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 22 Jul 2021 04:33:05 +0000 Subject: [PATCH 07/10] Apply 1 suggestion(s) to 1 file(s) --- gobject/gtype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gobject/gtype.h b/gobject/gtype.h index 56bbbd451a..5eae310d0a 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -2076,7 +2076,7 @@ type_name##_get_type (void) \ * Using this macro is the recommended way of defining new custom boxed * types, over calling g_boxed_type_register_static() directly. It defines * a `type_name_get_type()` function which will return the newly defined - * %GType, implemented as lazy instantiation. + * #GType, enabling lazy instantiation. * * |[ * G_DEFINE_BOXED_TYPE (MyStruct, my_struct, my_struct_copy, my_struct_free) -- GitLab From 9d77eadf548dd9591ed07a18aadfcf05dd1c978f Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 22 Jul 2021 04:33:21 +0000 Subject: [PATCH 08/10] Apply 1 suggestion(s) to 1 file(s) --- gobject/gtype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gobject/gtype.h b/gobject/gtype.h index 5eae310d0a..062a082422 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -2082,7 +2082,7 @@ type_name##_get_type (void) \ * G_DEFINE_BOXED_TYPE (MyStruct, my_struct, my_struct_copy, my_struct_free) * * void - * foo() + * foo () * { * GType type = my_struct_get_type(); * // ... your code ... -- GitLab From 4e7edb3d6a5e09ccf19e212c6fa531ad3fce3b03 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 22 Jul 2021 04:33:34 +0000 Subject: [PATCH 09/10] Apply 1 suggestion(s) to 1 file(s) --- gobject/gtype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gobject/gtype.h b/gobject/gtype.h index 062a082422..f38b4cf4c9 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -2084,7 +2084,7 @@ type_name##_get_type (void) \ * void * foo () * { - * GType type = my_struct_get_type(); + * GType type = my_struct_get_type (); * // ... your code ... * } * -- GitLab From 5f21db77e6afda0e8461ab26daba59ca978e928f Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 22 Jul 2021 12:05:15 +0000 Subject: [PATCH 10/10] Apply 1 suggestion(s) to 1 file(s) --- gobject/gboxed.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gobject/gboxed.c b/gobject/gboxed.c index 71073ad696..e6bd786ab7 100644 --- a/gobject/gboxed.c +++ b/gobject/gboxed.c @@ -285,8 +285,7 @@ boxed_proxy_lcopy_value (const GValue *value, * * For the general case, it is recommended to use #G_DEFINE_BOXED_TYPE * instead of calling g_boxed_type_register_static() directly. The macro - * will resolve the problem of a having to initialize a global variable - * containing the %GType. + * will create the appropriate `*_get_type()` function for the boxed type. * * Returns: New %G_TYPE_BOXED derived type id for @name. */ -- GitLab