gobject-introspection r906 - in trunk: . girepository



Author: otaylor
Date: Wed Nov 12 17:17:15 2008
New Revision: 906
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=906&view=rev

Log:
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.

Modified:
   trunk/ChangeLog
   trunk/girepository/girparser.c

Modified: trunk/girepository/girparser.c
==============================================================================
--- trunk/girepository/girparser.c	(original)
+++ trunk/girepository/girparser.c	Wed Nov 12 17:17:15 2008
@@ -31,7 +31,7 @@
 struct _GIrParser
 {
   gchar **includes;
-  GList *include_modules; /* All previously parsed include modules */
+  GList *parsed_modules; /* All previously parsed modules */
 };
 
 typedef enum
@@ -145,9 +145,14 @@
 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);
 }
 
@@ -2206,7 +2211,7 @@
   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;
 
@@ -2214,6 +2219,8 @@
 	{
 	  if (strcmp (m->version, version) == 0)
 	    {
+	      ctx->include_modules = g_list_prepend (ctx->include_modules, m);
+
 	      return TRUE;
 	    }
 	  else
@@ -3054,6 +3061,9 @@
   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)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]