[glib] Add a boxed type for GError



commit b440cc154669b492b5301e221d85bf6b8586a994
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Apr 22 20:10:56 2010 -0400

    Add a boxed type for GError
    
    Patch by Sebastian Dröge, bug 614541

 gobject/gboxed.c        |   13 +++++++++++++
 gobject/gboxed.h        |    9 +++++++++
 gobject/gobject.symbols |    1 +
 3 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gobject/gboxed.c b/gobject/gboxed.c
index 8b515ad..f18ffb5 100644
--- a/gobject/gboxed.c
+++ b/gobject/gboxed.c
@@ -299,6 +299,19 @@ g_variant_get_gtype (void)
   return type_id;
 }
 
+GType
+g_error_get_type (void)
+{
+  static GType type_id = 0;
+
+  if (!type_id)
+    type_id = g_boxed_type_register_static (g_intern_static_string ("GError"),
+                                            (GBoxedCopyFunc) g_error_copy,
+                                            (GBoxedFreeFunc) g_error_free);
+
+  return type_id;
+}
+
 static void
 boxed_proxy_value_init (GValue *value)
 {
diff --git a/gobject/gboxed.h b/gobject/gboxed.h
index 10e293f..f46728b 100644
--- a/gobject/gboxed.h
+++ b/gobject/gboxed.h
@@ -202,6 +202,14 @@ GType	g_boxed_type_register_static		(const gchar	*name,
  * Since: 2.24
  */
 #define	G_TYPE_VARIANT (g_variant_get_gtype ())
+/**
+ * G_TYPE_ERROR:
+ * 
+ * The #GType for a boxed type holding a #GError.
+ * 
+ * Since: 2.26
+ */
+#define	G_TYPE_ERROR (g_error_get_type ())
 
 
 void    g_value_take_boxed      (GValue		*value,
@@ -223,6 +231,7 @@ GType   g_ptr_array_get_type    (void)  G_GNUC_CONST;
 GType   g_variant_type_get_gtype(void)  G_GNUC_CONST;
 GType   g_variant_get_gtype     (void)  G_GNUC_CONST;
 GType   g_regex_get_type        (void)  G_GNUC_CONST;
+GType   g_error_get_type        (void)  G_GNUC_CONST;
 
 /**
  * GStrv:
diff --git a/gobject/gobject.symbols b/gobject/gobject.symbols
index aa91a3e..871e7cd 100644
--- a/gobject/gobject.symbols
+++ b/gobject/gobject.symbols
@@ -22,6 +22,7 @@ g_strv_get_type G_GNUC_CONST
 g_hash_table_get_type G_GNUC_CONST
 g_array_get_type G_GNUC_CONST
 g_byte_array_get_type G_GNUC_CONST
+g_error_get_type G_GNUC_CONST
 g_ptr_array_get_type G_GNUC_CONST
 g_regex_get_type G_GNUC_CONST
 g_variant_type_get_gtype G_GNUC_CONST



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