[gimp/wip/nielsdg/g-define-boxed-type: 1346/1347] libgimpbase: Use G_DEFINE_BOXED_TYPE()
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/nielsdg/g-define-boxed-type: 1346/1347] libgimpbase: Use G_DEFINE_BOXED_TYPE()
- Date: Mon, 4 Nov 2019 07:02:59 +0000 (UTC)
commit 30afc3b672dba7821d3212672597d7740cf28508
Author: Niels De Graef <nielsdegraef gmail com>
Date: Wed Jul 17 07:02:04 2019 +0200
libgimpbase: Use G_DEFINE_BOXED_TYPE()
This isn't any functional change, but allows us to get rid of some of
the GObject boilerplate.
libgimpbase/gimpparamspecs.c | 108 ++++---------------------------------------
libgimpbase/gimpparasite.c | 14 +-----
2 files changed, 9 insertions(+), 113 deletions(-)
---
diff --git a/libgimpbase/gimpparamspecs.c b/libgimpbase/gimpparamspecs.c
index 1b3e46b1fb..1b68f4cebc 100644
--- a/libgimpbase/gimpparamspecs.c
+++ b/libgimpbase/gimpparamspecs.c
@@ -69,18 +69,7 @@ gimp_array_free (GimpArray *array)
}
}
-GType
-gimp_array_get_type (void)
-{
- static GType type = 0;
-
- if (! type)
- type = g_boxed_type_register_static ("GimpArray",
- (GBoxedCopyFunc) gimp_array_copy,
- (GBoxedFreeFunc) gimp_array_free);
-
- return type;
-}
+G_DEFINE_BOXED_TYPE (GimpArray, gimp_array, gimp_array_copy, gimp_array_free)
/*
@@ -263,19 +252,7 @@ gimp_value_take_array (GValue *value,
* GIMP_TYPE_UINT8_ARRAY
*/
-GType
-gimp_uint8_array_get_type (void)
-{
- static GType type = 0;
-
- if (! type)
- type = g_boxed_type_register_static ("GimpUInt8Array",
- (GBoxedCopyFunc) gimp_array_copy,
- (GBoxedFreeFunc) gimp_array_free);
-
- return type;
-}
-
+G_DEFINE_BOXED_TYPE (GimpUint8Array, gimp_uint8_array, gimp_array_copy, gimp_array_free)
/*
* GIMP_TYPE_PARAM_UINT8_ARRAY
@@ -401,18 +378,7 @@ gimp_value_take_uint8_array (GValue *value,
* GIMP_TYPE_INT16_ARRAY
*/
-GType
-gimp_int16_array_get_type (void)
-{
- static GType type = 0;
-
- if (! type)
- type = g_boxed_type_register_static ("GimpInt16Array",
- (GBoxedCopyFunc) gimp_array_copy,
- (GBoxedFreeFunc) gimp_array_free);
-
- return type;
-}
+G_DEFINE_BOXED_TYPE (GimpInt16Array, gimp_int16_array, gimp_array_copy, gimp_array_free)
/*
@@ -542,19 +508,7 @@ gimp_value_take_int16_array (GValue *value,
* GIMP_TYPE_INT32_ARRAY
*/
-GType
-gimp_int32_array_get_type (void)
-{
- static GType type = 0;
-
- if (! type)
- type = g_boxed_type_register_static ("GimpInt32Array",
- (GBoxedCopyFunc) gimp_array_copy,
- (GBoxedFreeFunc) gimp_array_free);
-
- return type;
-}
-
+G_DEFINE_BOXED_TYPE (GimpInt32Array, gimp_int32_array, gimp_array_copy, gimp_array_free)
/*
* GIMP_TYPE_PARAM_INT32_ARRAY
@@ -683,19 +637,7 @@ gimp_value_take_int32_array (GValue *value,
* GIMP_TYPE_FLOAT_ARRAY
*/
-GType
-gimp_float_array_get_type (void)
-{
- static GType type = 0;
-
- if (! type)
- type = g_boxed_type_register_static ("GimpFloatArray",
- (GBoxedCopyFunc) gimp_array_copy,
- (GBoxedFreeFunc) gimp_array_free);
-
- return type;
-}
-
+G_DEFINE_BOXED_TYPE (GimpFloatArray, gimp_float_array, gimp_array_copy, gimp_array_free)
/*
* GIMP_TYPE_PARAM_FLOAT_ARRAY
@@ -911,19 +853,7 @@ gimp_string_array_free (GimpStringArray *array)
}
}
-GType
-gimp_string_array_get_type (void)
-{
- static GType type = 0;
-
- if (! type)
- type = g_boxed_type_register_static ("GimpStringArray",
- (GBoxedCopyFunc) gimp_string_array_copy,
- (GBoxedFreeFunc) gimp_string_array_free);
-
- return type;
-}
-
+G_DEFINE_BOXED_TYPE (GimpStringArray, gimp_string_array, gimp_array_copy, gimp_array_free)
/*
* GIMP_TYPE_PARAM_STRING_ARRAY
@@ -1146,18 +1076,7 @@ gimp_value_take_string_array (GValue *value,
* GIMP_TYPE_RGB_ARRAY
*/
-GType
-gimp_rgb_array_get_type (void)
-{
- static GType type = 0;
-
- if (! type)
- type = g_boxed_type_register_static ("GimpRGBArray",
- (GBoxedCopyFunc) gimp_array_copy,
- (GBoxedFreeFunc) gimp_array_free);
-
- return type;
-}
+G_DEFINE_BOXED_TYPE (GimpRGBArray, gimp_rgb_array, gimp_array_copy, gimp_array_free)
/*
@@ -1380,18 +1299,7 @@ gimp_object_array_free (GimpObjectArray *array)
}
}
-GType
-gimp_object_array_get_type (void)
-{
- static GType type = 0;
-
- if (! type)
- type = g_boxed_type_register_static ("GimpObjectArray",
- (GBoxedCopyFunc) gimp_object_array_copy,
- (GBoxedFreeFunc) gimp_object_array_free);
-
- return type;
-}
+G_DEFINE_BOXED_TYPE (GimpObjectArray, gimp_object_array, gimp_array_copy, gimp_array_free)
/*
diff --git a/libgimpbase/gimpparasite.c b/libgimpbase/gimpparasite.c
index bf9f219cee..ddfd352f12 100644
--- a/libgimpbase/gimpparasite.c
+++ b/libgimpbase/gimpparasite.c
@@ -55,19 +55,7 @@
* GIMP_TYPE_PARASITE
*/
-GType
-gimp_parasite_get_type (void)
-{
- static GType type = 0;
-
- if (! type)
- type = g_boxed_type_register_static ("GimpParasite",
- (GBoxedCopyFunc) gimp_parasite_copy,
- (GBoxedFreeFunc) gimp_parasite_free);
-
- return type;
-}
-
+G_DEFINE_BOXED_TYPE (GimpParasite, gimp_parasite, gimp_parasite_copy, gimp_parasite_free)
/*
* GIMP_TYPE_PARAM_PARASITE
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]