[pango] Use G_DEFINE_BOXED_TYPE.



commit 807c776bf36667c697c0c9bd76d37160e9c1d8cc
Author: Christian Persch <chpe gnome org>
Date:   Sat May 24 16:22:06 2008 +0200

    Use G_DEFINE_BOXED_TYPE.
    
    Bug #539622.

 configure.in             |    2 +-
 pango/fonts.c            |   32 ++++++--------------------------
 pango/glyphstring.c      |   15 +++------------
 pango/pango-attributes.c |   15 +++------------
 pango/pango-color.c      |   15 +++------------
 pango/pango-glyph-item.c |   28 ++++++----------------------
 pango/pango-item.c       |   14 +++-----------
 pango/pango-language.c   |   14 +++-----------
 pango/pango-layout.c     |   29 ++++++-----------------------
 pango/pango-matrix.c     |   15 +++------------
 pango/pango-tabs.c       |   14 +++-----------
 11 files changed, 40 insertions(+), 153 deletions(-)
---
diff --git a/configure.in b/configure.in
index d5007de..03c79a8 100644
--- a/configure.in
+++ b/configure.in
@@ -446,7 +446,7 @@ fi
 #
 # Checks for GLib
 #
-GLIB_REQUIRED_VERSION=2.17.3
+GLIB_REQUIRED_VERSION=2.26.0
 GLIB_MODULES="glib-2.0 >= $GLIB_REQUIRED_VERSION gobject-2.0 gmodule-no-export-2.0"
 
 PKG_CHECK_MODULES(GLIB, $GLIB_MODULES, :,
diff --git a/pango/fonts.c b/pango/fonts.c
index ab5397a..34cd67c 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -46,19 +46,9 @@ struct _PangoFontDescription
   int size;
 };
 
-GType
-pango_font_description_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type = g_boxed_type_register_static (I_("PangoFontDescription"),
-					     (GBoxedCopyFunc)pango_font_description_copy,
-					     (GBoxedFreeFunc)pango_font_description_free);
-
-  return our_type;
-}
-
+G_DEFINE_BOXED_TYPE (PangoFontDescription, pango_font_description,
+                     pango_font_description_copy,
+                     pango_font_description_free);
 
 static const PangoFontDescription pfd_defaults = {
   NULL,			/* family_name */
@@ -1670,19 +1660,9 @@ pango_font_get_font_map (PangoFont *font)
     return NULL;
 }
 
-GType
-pango_font_metrics_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type = g_boxed_type_register_static (I_("PangoFontMetrics"),
-					     (GBoxedCopyFunc)pango_font_metrics_ref,
-					     (GBoxedFreeFunc)pango_font_metrics_unref);
-
-  return our_type;
-}
-
+G_DEFINE_BOXED_TYPE (PangoFontMetrics, pango_font_metrics,
+                     pango_font_metrics_ref,
+                     pango_font_metrics_unref);
 
 /**
  * pango_font_metrics_new:
diff --git a/pango/glyphstring.c b/pango/glyphstring.c
index dedd822..e407bd6 100644
--- a/pango/glyphstring.c
+++ b/pango/glyphstring.c
@@ -91,18 +91,9 @@ pango_glyph_string_set_size (PangoGlyphString *string, gint new_len)
   string->num_glyphs = new_len;
 }
 
-GType
-pango_glyph_string_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type = g_boxed_type_register_static (I_("PangoGlyphString"),
-					     (GBoxedCopyFunc)pango_glyph_string_copy,
-					     (GBoxedFreeFunc)pango_glyph_string_free);
-
-  return our_type;
-}
+G_DEFINE_BOXED_TYPE (PangoGlyphString, pango_glyph_string,
+                     pango_glyph_string_copy,
+                     pango_glyph_string_free);
 
 /**
  * pango_glyph_string_copy:
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 28c11de..a253a67 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1084,18 +1084,9 @@ pango_attr_gravity_hint_new (PangoGravityHint hint)
  * Attribute List
  */
 
-GType
-pango_attr_list_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type = g_boxed_type_register_static (I_("PangoAttrList"),
-					     (GBoxedCopyFunc) pango_attr_list_copy,
-					     (GBoxedFreeFunc) pango_attr_list_unref);
-
-  return our_type;
-}
+G_DEFINE_BOXED_TYPE (PangoAttrList, pango_attr_list,
+                     pango_attr_list_copy,
+                     pango_attr_list_unref);
 
 /**
  * pango_attr_list_new:
diff --git a/pango/pango-color.c b/pango/pango-color.c
index 271638a..e057729 100644
--- a/pango/pango-color.c
+++ b/pango/pango-color.c
@@ -27,18 +27,9 @@
 #include "pango-attributes.h"
 #include "pango-impl-utils.h"
 
-GType
-pango_color_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type = g_boxed_type_register_static (I_("PangoColor"),
-					     (GBoxedCopyFunc) pango_color_copy,
-					     (GBoxedFreeFunc) pango_color_free);
-
-  return our_type;
-}
+G_DEFINE_BOXED_TYPE (PangoColor, pango_color,
+                     pango_color_copy,
+                     pango_color_free);
 
 /**
  * pango_color_copy:
diff --git a/pango/pango-glyph-item.c b/pango/pango-glyph-item.c
index d60e7be..49d4b07 100644
--- a/pango/pango-glyph-item.c
+++ b/pango/pango-glyph-item.c
@@ -179,17 +179,9 @@ pango_glyph_item_free  (PangoGlyphItem *glyph_item)
   g_slice_free (PangoGlyphItem, glyph_item);
 }
 
-GType
-pango_glyph_item_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type = g_boxed_type_register_static (I_("PangoGlyphItem"),
-					     (GBoxedCopyFunc) pango_glyph_item_copy,
-					     (GBoxedFreeFunc) pango_glyph_item_free);
-  return our_type;
-}
+G_DEFINE_BOXED_TYPE (PangoGlyphItem, pango_glyph_item,
+                     pango_glyph_item_copy,
+                     pango_glyph_item_free);
 
 
 /**
@@ -236,17 +228,9 @@ pango_glyph_item_iter_free  (PangoGlyphItemIter *iter)
   g_slice_free (PangoGlyphItemIter, iter);
 }
 
-GType
-pango_glyph_item_iter_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type = g_boxed_type_register_static (I_("PangoGlyphItemIter"),
-					     (GBoxedCopyFunc) pango_glyph_item_iter_copy,
-					     (GBoxedFreeFunc) pango_glyph_item_iter_free);
-  return our_type;
-}
+G_DEFINE_BOXED_TYPE (PangoGlyphItemIter, pango_glyph_item_iter,
+                     pango_glyph_item_iter_copy,
+                     pango_glyph_item_iter_free)
 
 /**
  * pango_glyph_item_iter_next_cluster:
diff --git a/pango/pango-item.c b/pango/pango-item.c
index 9d8edd0..0437d9c 100644
--- a/pango/pango-item.c
+++ b/pango/pango-item.c
@@ -106,17 +106,9 @@ pango_item_free (PangoItem *item)
   g_slice_free (PangoItem, item);
 }
 
-GType
-pango_item_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type = g_boxed_type_register_static (I_("PangoItem"),
-					     (GBoxedCopyFunc) pango_item_copy,
-					     (GBoxedFreeFunc) pango_item_free);
-  return our_type;
-}
+G_DEFINE_BOXED_TYPE (PangoItem, pango_item,
+                     pango_item_copy,
+                     pango_item_free);
 
 /**
  * pango_item_split:
diff --git a/pango/pango-language.c b/pango/pango-language.c
index bfde308..a167588 100644
--- a/pango/pango-language.c
+++ b/pango/pango-language.c
@@ -129,17 +129,9 @@ pango_language_free (PangoLanguage *language G_GNUC_UNUSED)
   return; /* nothing */
 }
 
-GType
-pango_language_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type = g_boxed_type_register_static (I_("PangoLanguage"),
-					     (GBoxedCopyFunc)pango_language_copy,
-					     (GBoxedFreeFunc)pango_language_free);
-  return our_type;
-}
+G_DEFINE_BOXED_TYPE (PangoLanguage, pango_language,
+                     pango_language_copy,
+                     pango_language_free);
 
 /**
  * _pango_get_lc_ctype:
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 9bdaa1c..ee0e09c 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3932,17 +3932,9 @@ pango_layout_line_unref (PangoLayoutLine *line)
     }
 }
 
-GType
-pango_layout_line_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type = g_boxed_type_register_static (I_("PangoLayoutLine"),
-					     (GBoxedCopyFunc) pango_layout_line_ref,
-					     (GBoxedFreeFunc) pango_layout_line_unref);
-  return our_type;
-}
+G_DEFINE_BOXED_TYPE (PangoLayoutLine, pango_layout_line,
+                     pango_layout_line_ref,
+                     pango_layout_line_unref);
 
 /**
  * pango_layout_line_x_to_index:
@@ -5462,18 +5454,9 @@ pango_layout_iter_copy (PangoLayoutIter *iter)
   return new;
 }
 
-GType
-pango_layout_iter_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type = g_boxed_type_register_static (I_("PangoLayoutIter"),
-					     (GBoxedCopyFunc) pango_layout_iter_copy,
-					     (GBoxedFreeFunc) pango_layout_iter_free);
-
-  return our_type;
-}
+G_DEFINE_BOXED_TYPE (PangoLayoutIter, pango_layout_iter,
+                     pango_layout_iter_copy,
+                     pango_layout_iter_free);
 
 /**
  * pango_layout_get_iter:
diff --git a/pango/pango-matrix.c b/pango/pango-matrix.c
index 70a1698..f3a47e4 100644
--- a/pango/pango-matrix.c
+++ b/pango/pango-matrix.c
@@ -26,18 +26,9 @@
 #include "pango-matrix.h"
 #include "pango-impl-utils.h"
 
-GType
-pango_matrix_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type = g_boxed_type_register_static (I_("PangoMatrix"),
-					     (GBoxedCopyFunc) pango_matrix_copy,
-					     (GBoxedFreeFunc) pango_matrix_free);
-
-  return our_type;
-}
+G_DEFINE_BOXED_TYPE (PangoMatrix, pango_matrix,
+                     pango_matrix_copy,
+                     pango_matrix_free);
 
 /**
  * pango_matrix_copy:
diff --git a/pango/pango-tabs.c b/pango/pango-tabs.c
index 6091d27..aec8612 100644
--- a/pango/pango-tabs.c
+++ b/pango/pango-tabs.c
@@ -156,17 +156,9 @@ pango_tab_array_new_with_positions (gint           size,
   return array;
 }
 
-GType
-pango_tab_array_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type = g_boxed_type_register_static (I_("PangoTabArray"),
-					     (GBoxedCopyFunc)pango_tab_array_copy,
-					     (GBoxedFreeFunc)pango_tab_array_free);
-  return our_type;
-}
+G_DEFINE_BOXED_TYPE (PangoTabArray, pango_tab_array,
+                     pango_tab_array_copy,
+                     pango_tab_array_free);
 
 /**
  * pango_tab_array_copy:



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