From 0449abe8987cb6a0f81f0e31a3dc0dcef6562bbd Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 25 Aug 2010 13:14:57 -0400 Subject: [PATCH] scanner: Avoid internal invalid Type instances from parents We were adding a trailing ',' in the parent string, clean that up; and don't attempt to create a Type from the empty string. --- gdump.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gdump.c b/gdump.c index 3dc21728f..84ac3c718 100644 --- a/gdump.c +++ b/gdump.c @@ -168,17 +168,17 @@ dump_object_type (GType type, const char *symbol, GOutputStream *out) GType parent; gboolean first = TRUE; - parent = type; + parent = g_type_parent (type); parent_str = g_string_new (""); - do + while (parent != G_TYPE_OBJECT && parent != G_TYPE_INVALID) { - parent = g_type_parent (parent); if (first) first = FALSE; else g_string_append_c (parent_str, ','); g_string_append (parent_str, g_type_name (parent)); - } while (parent != G_TYPE_OBJECT && parent != G_TYPE_INVALID); + parent = g_type_parent (parent); + } escaped_printf (out, " parents=\"%s\"", parent_str->str); @@ -299,11 +299,10 @@ dump_fundamental_type (GType type, const char *symbol, GOutputStream *out) if (G_TYPE_IS_INSTANTIATABLE (type)) escaped_printf (out, " instantiatable=\"1\""); - parent = type; + parent = g_type_parent (type); parent_str = g_string_new (""); - do + while (parent != G_TYPE_INVALID) { - parent = g_type_parent (parent); if (first) first = FALSE; else @@ -311,7 +310,8 @@ dump_fundamental_type (GType type, const char *symbol, GOutputStream *out) if (!g_type_name (parent)) break; g_string_append (parent_str, g_type_name (parent)); - } while (parent != G_TYPE_INVALID); + parent = g_type_parent (parent); + } if (parent_str->len > 0) escaped_printf (out, " parents=\"%s\"", parent_str->str);