From: Matthias Clasen Date: Sat, 19 Oct 2002 23:59:51 +0000 (+0000) Subject: Report only the most specific instantiatable prerequisite, filter out all X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=b95ffb852cf9418119794f0bc3f7dcb407f96ce3;p=dana%2Fcg-glib.git Report only the most specific instantiatable prerequisite, filter out all * gtype.c (g_type_interface_prerequisites): Report only the most specific instantiatable prerequisite, filter out all supertypes of this one (the supertypes are added to the prerequisites array for technical reasons). --- diff --git a/gobject/gtype.c b/gobject/gtype.c index f9d0edd4..7a302da7 100644 --- a/gobject/gtype.c +++ b/gobject/gtype.c @@ -1241,20 +1241,30 @@ g_type_interface_prerequisites (GType interface_type, iface = lookup_type_node_I (interface_type); if (iface) { - GType *prerequisites; - guint i; + GType *types; + TypeNode *inode = NULL; + guint i, n = 0; G_READ_LOCK (&type_rw_lock); - prerequisites = g_new (GType, IFACE_NODE_N_PREREQUISITES (iface) + 1); + types = g_new0 (GType, IFACE_NODE_N_PREREQUISITES (iface) + 1); for (i = 0; i < IFACE_NODE_N_PREREQUISITES (iface); i++) - prerequisites[i] = IFACE_NODE_PREREQUISITES (iface)[i]; - prerequisites[i] = 0; + { + GType prerequisite = IFACE_NODE_PREREQUISITES (iface)[i]; + TypeNode *node = lookup_type_node_I (prerequisite); + if (node->is_instantiatable && + (!inode || type_node_is_a_L (node, inode))) + inode = node; + else + types[n++] = NODE_TYPE (node); + } + if (inode) + types[n++] = NODE_TYPE (inode); if (n_prerequisites) - *n_prerequisites = IFACE_NODE_N_PREREQUISITES (iface); + *n_prerequisites = n; G_READ_UNLOCK (&type_rw_lock); - return prerequisites; + return types; } else {