[gimp/wip/nielsdg/g-define-boxed-type: 6/6] libgimpmath: Use G_DEFINE_BOXED_TYPE()



commit cc21ec304fafdb198f22cafa13a60834ad52c85e
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Wed Jul 17 07:04:59 2019 +0200

    libgimpmath: Use G_DEFINE_BOXED_TYPE()
    
    This isn't any functional change, but allows us to get rid of some of
    the GObject boilerplate.

 libgimpmath/gimpmatrix.c | 44 ++------------------------------------------
 1 file changed, 2 insertions(+), 42 deletions(-)
---
diff --git a/libgimpmath/gimpmatrix.c b/libgimpmath/gimpmatrix.c
index 8ede5b26f6..836978ab1c 100644
--- a/libgimpmath/gimpmatrix.c
+++ b/libgimpmath/gimpmatrix.c
@@ -49,27 +49,7 @@
 
 static GimpMatrix2 * matrix2_copy                  (const GimpMatrix2 *matrix);
 
-/**
- * gimp_matrix2_get_type:
- *
- * Reveals the object type
- *
- * Returns: the #GType for Matrix2 objects
- *
- * Since: 2.4
- **/
-GType
-gimp_matrix2_get_type (void)
-{
-  static GType matrix_type = 0;
-
-  if (!matrix_type)
-    matrix_type = g_boxed_type_register_static ("GimpMatrix2",
-                                               (GBoxedCopyFunc) matrix2_copy,
-                                               (GBoxedFreeFunc) g_free);
-
-  return matrix_type;
-}
+G_DEFINE_BOXED_TYPE (GimpMatrix2, gimp_matrix2, matrix2_copy, g_free)
 
 
 /*
@@ -267,27 +247,7 @@ gimp_matrix2_mult (const GimpMatrix2 *matrix1,
 
 static GimpMatrix3 * matrix3_copy                  (const GimpMatrix3 *matrix);
 
-/**
- * gimp_matrix3_get_type:
- *
- * Reveals the object type
- *
- * Returns: the #GType for Matrix3 objects
- *
- * Since: 2.8
- **/
-GType
-gimp_matrix3_get_type (void)
-{
-  static GType matrix_type = 0;
-
-  if (!matrix_type)
-    matrix_type = g_boxed_type_register_static ("GimpMatrix3",
-                                               (GBoxedCopyFunc) matrix3_copy,
-                                               (GBoxedFreeFunc) g_free);
-
-  return matrix_type;
-}
+G_DEFINE_BOXED_TYPE (GimpMatrix3, gimp_matrix3, matrix3_copy, g_free)
 
 
 /*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]