added debugging variants g_type_name_from_class(),
authorTim Janik <timj@gtk.org>
Wed, 20 Jun 2001 02:32:10 +0000 (02:32 +0000)
committerTim Janik <timj@src.gnome.org>
Wed, 20 Jun 2001 02:32:10 +0000 (02:32 +0000)
Wed Jun 20 03:59:42 2001  Tim Janik  <timj@gtk.org>

        * gtype.[hc]: added debugging variants g_type_name_from_class(),
        g_type_name_from_instance().

gobject/ChangeLog
gobject/gtype.c
gobject/gtype.h

index 1993ca34e489239a343b3efd16592c5dfd5e510f..201752313e288357a85a6e8cfef05e644918736c 100644 (file)
@@ -1,3 +1,8 @@
+Wed Jun 20 03:59:42 2001  Tim Janik  <timj@gtk.org>
+
+       * gtype.[hc]: added debugging variants g_type_name_from_class(),
+       g_type_name_from_instance().
+
 Mon Jun 11 17:07:06 2001  Tim Janik  <timj@gtk.org>
 
        * gboxed.[hc]: remove left-over usages of an anonymous GBoxed typedef.
index 664580be3f363291353196db2f14c94fafd738d4..50edc4582431934999ffd8bc3540e71c5ebc3cc1 100644 (file)
@@ -2737,6 +2737,24 @@ g_type_value_table_peek (GType type)
   return vtable;
 }
 
+G_CONST_RETURN gchar*
+g_type_name_from_instance (GTypeInstance *instance)
+{
+  if (!instance)
+    return "<NULL-instance>";
+  else
+    return g_type_name_from_class (instance->g_class);
+}
+
+G_CONST_RETURN gchar*
+g_type_name_from_class (GTypeClass *g_class)
+{
+  if (!g_class)
+    return "<NULL-class>";
+  else
+    return g_type_name (g_class->g_type);
+}
+
 
 /* --- foreign prototypes --- */
 extern void    g_value_types_init      (void); /* sync with gvaluetypes.c */
index 2bdb5c2959941ba7dd5fe14c7ebc69f068fa13b5..07daee580ca9febf70c9ff7ad9f961d4b3fe36ad 100644 (file)
@@ -350,6 +350,11 @@ gboolean    g_type_check_value_holds       (GValue             *value,
 GTypeValueTable* g_type_value_table_peek        (GType              type);
 
 
+/* --- debugging functions --- */
+G_CONST_RETURN gchar* g_type_name_from_instance        (GTypeInstance  *instance);
+G_CONST_RETURN gchar* g_type_name_from_class   (GTypeClass     *g_class);
+
+
 /* --- implementation bits --- */
 #ifndef G_DISABLE_CAST_CHECKS
 #  define _G_TYPE_CIC(ip, gt, ct) \