+2008-11-12 Owen Taylor <otaylor@redhat.com>
+
+ Bug 560419 – Cache includes when parsing
+
+ Keep track of all modules parsed within a GIrParser, and when a
+ module is referenced a second time, use the existing parsed copy
+ instead of reparsing.
+
2008-11-12 Owen Taylor <otaylor@redhat.com>
Fix management of ParseContext.includes_modules (#560419)
struct _GIrParser
{
gchar **includes;
- GList *include_modules; /* All previously parsed include modules */
+ GList *parsed_modules; /* All previously parsed modules */
};
typedef enum
void
g_ir_parser_free (GIrParser *parser)
{
+ GList *l;
+
if (parser->includes)
g_strfreev (parser->includes);
+ for (l = parser->parsed_modules; l; l = l->next)
+ g_ir_module_free (l->data);
+
g_slice_free (GIrParser, parser);
}
GList *modules;
GList *l;
- for (l = ctx->include_modules; l; l = l->next)
+ for (l = ctx->parser->parsed_modules; l; l = l->next)
{
GIrModule *m = l->data;
{
if (strcmp (m->version, version) == 0)
{
+ ctx->include_modules = g_list_prepend (ctx->include_modules, m);
+
return TRUE;
}
else
if (!g_markup_parse_context_end_parse (context, error))
goto out;
+ parser->parsed_modules = g_list_concat (g_list_copy (ctx.modules),
+ parser->parsed_modules);
+
out:
if (ctx.modules == NULL)