From: Juerg Billeter Date: Thu, 22 Nov 2007 16:19:07 +0000 (+0000) Subject: don't process get_type function symbols twice, support Interface suffix in X-Git-Tag: VALA_0_1_5~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1a29396d643946d08dd3d55a0f7e95731561e76;p=platform%2Fupstream%2Fvala.git don't process get_type function symbols twice, support Interface suffix in 2007-11-22 Juerg Billeter * gobject-introspection/gen-introspect.c: don't process get_type function symbols twice, support Interface suffix in addition to the more common Iface suffix svn path=/trunk/; revision=697 --- diff --git a/ChangeLog b/ChangeLog index 2ba281e..09f56af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-11-22 Jürg Billeter + * gobject-introspection/gen-introspect.c: don't process get_type + function symbols twice, support Interface suffix in addition to the + more common Iface suffix + +2007-11-22 Jürg Billeter + * vala/parser.y, vala/valacodecontext.vala, vala/valacreationmethod.vala, vala/valasemanticanalyzer.vala, vapigen/valagidlparser.vala: report error for missing return types in diff --git a/gobject-introspection/gen-introspect.c b/gobject-introspection/gen-introspect.c index 48d41a2..6d9d4f6 100644 --- a/gobject-introspection/gen-introspect.c +++ b/gobject-introspection/gen-introspect.c @@ -483,10 +483,20 @@ static void g_igenerator_process_types (GIGenerator *igenerator) } for (l = igenerator->get_type_symbols; l != NULL; l = l->next) { char *get_type_symbol = l->data; + + if (get_type_symbol == NULL) { + /* ignore already processed functions */ + continue; + } + TypeFunction type_fun; if (!g_module_symbol (module, get_type_symbol, (gpointer*) &type_fun)) { continue; } + + /* symbol found, ignore in future iterations */ + l->data = NULL; + GType type_id = type_fun (); GType type_fundamental = g_type_fundamental (type_id); char *lower_case_prefix = str_replace (g_strndup (get_type_symbol, strlen (get_type_symbol) - strlen ("_get_type")), "_", ""); @@ -771,8 +781,13 @@ static void g_igenerator_process_struct_typedef (GIGenerator *igenerator, CSymbo gifield->type = get_type_from_ctype (member->base_type); } } - } else if (!opaque_type && (g_str_has_suffix (sym->ident, "Class") || g_str_has_suffix (sym->ident, "Iface"))) { - char *base_name = g_strndup (sym->ident, strlen (sym->ident) - 5); + } else if (!opaque_type && (g_str_has_suffix (sym->ident, "Class") || g_str_has_suffix (sym->ident, "Iface") || g_str_has_suffix (sym->ident, "Interface"))) { + char *base_name; + if (g_str_has_suffix (sym->ident, "Interface")) { + base_name = g_strndup (sym->ident, strlen (sym->ident) - strlen ("Interface")); + } else { + base_name = g_strndup (sym->ident, strlen (sym->ident) - strlen ("Class")); + } gitype = g_hash_table_lookup (igenerator->type_map, base_name); if (gitype == NULL || (gitype->type != G_IDL_NODE_OBJECT && gitype->type != G_IDL_NODE_INTERFACE)) { g_igenerator_process_unregistered_struct_typedef (igenerator, sym, struct_type);