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



commit b6695ff426d753e54eaf536f8865c1d04ed53f32
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 4e058ded48..d6c9066a40 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]