mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
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.
This commit is contained in:
parent
35cb08a25e
commit
0449abe898
16
gdump.c
16
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);
|
||||
|
Loading…
Reference in New Issue
Block a user