mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 07:26:15 +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;
|
GType parent;
|
||||||
gboolean first = TRUE;
|
gboolean first = TRUE;
|
||||||
|
|
||||||
parent = type;
|
parent = g_type_parent (type);
|
||||||
parent_str = g_string_new ("");
|
parent_str = g_string_new ("");
|
||||||
do
|
while (parent != G_TYPE_OBJECT && parent != G_TYPE_INVALID)
|
||||||
{
|
{
|
||||||
parent = g_type_parent (parent);
|
|
||||||
if (first)
|
if (first)
|
||||||
first = FALSE;
|
first = FALSE;
|
||||||
else
|
else
|
||||||
g_string_append_c (parent_str, ',');
|
g_string_append_c (parent_str, ',');
|
||||||
g_string_append (parent_str, g_type_name (parent));
|
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);
|
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))
|
if (G_TYPE_IS_INSTANTIATABLE (type))
|
||||||
escaped_printf (out, " instantiatable=\"1\"");
|
escaped_printf (out, " instantiatable=\"1\"");
|
||||||
|
|
||||||
parent = type;
|
parent = g_type_parent (type);
|
||||||
parent_str = g_string_new ("");
|
parent_str = g_string_new ("");
|
||||||
do
|
while (parent != G_TYPE_INVALID)
|
||||||
{
|
{
|
||||||
parent = g_type_parent (parent);
|
|
||||||
if (first)
|
if (first)
|
||||||
first = FALSE;
|
first = FALSE;
|
||||||
else
|
else
|
||||||
@ -311,7 +310,8 @@ dump_fundamental_type (GType type, const char *symbol, GOutputStream *out)
|
|||||||
if (!g_type_name (parent))
|
if (!g_type_name (parent))
|
||||||
break;
|
break;
|
||||||
g_string_append (parent_str, g_type_name (parent));
|
g_string_append (parent_str, g_type_name (parent));
|
||||||
} while (parent != G_TYPE_INVALID);
|
parent = g_type_parent (parent);
|
||||||
|
}
|
||||||
|
|
||||||
if (parent_str->len > 0)
|
if (parent_str->len > 0)
|
||||||
escaped_printf (out, " parents=\"%s\"", parent_str->str);
|
escaped_printf (out, " parents=\"%s\"", parent_str->str);
|
||||||
|
Loading…
Reference in New Issue
Block a user