[gobject-introspection] girepository: Remove "optimization" for found prefixes



commit e1d4c8413bf3f2ed5e877ef472eca8a05f8152bd
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Jul 26 23:59:36 2015 -0700

    girepository: Remove "optimization" for found prefixes
    
    This optimization is bugged and broken in the case of certain
    libraries. GNOME uses a lot of prefixes with "G", so we'll almost always
    have found the prefix.
    
    This is specifically a problem for something like GXml.xDocument, which
    uses a type name starting with a lower-case letter, which fools the
    prefix logic, but we're also fooled by the "G" appearing in GLib and
    Gio.
    
    A more sophisticated version of this check would have three passes:
    check prefix with type-case, check prefix without type-case, global
    search, but this is an edge case and it doesn't feel worth it to write.

 girepository/girepository.c |   11 -----------
 1 files changed, 0 insertions(+), 11 deletions(-)
---
diff --git a/girepository/girepository.c b/girepository/girepository.c
index 4291b7e..4723c95 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -739,7 +739,6 @@ g_irepository_get_info (GIRepository *repository,
 typedef struct {
   const gchar *gtype_name;
   GITypelib *result_typelib;
-  gboolean found_prefix;
 } FindByGTypeData;
 
 static DirEntry *
@@ -757,8 +756,6 @@ find_by_gtype (GHashTable *table, FindByGTypeData *data, gboolean check_prefix)
         {
           if (!g_typelib_matches_gtype_name_prefix (typelib, data->gtype_name))
             continue;
-
-          data->found_prefix = TRUE;
         }
 
       ret = g_typelib_get_dir_entry_by_gtype_name (typelib, data->gtype_name);
@@ -805,7 +802,6 @@ g_irepository_find_by_gtype (GIRepository *repository,
 
   data.gtype_name = g_type_name (gtype);
   data.result_typelib = NULL;
-  data.found_prefix = FALSE;
 
   /* Inside each typelib, we include the "C prefix" which acts as
    * a namespace mechanism.  For GtkTreeView, the C prefix is Gtk.
@@ -818,13 +814,6 @@ g_irepository_find_by_gtype (GIRepository *repository,
   if (entry == NULL)
     entry = find_by_gtype (repository->priv->lazy_typelibs, &data, TRUE);
 
-  /* If we have no result, but we did find a typelib claiming to
-   * offer bindings for such a prefix, bail out now on the assumption
-   * that a more exhaustive search would not produce any results.
-   */
-  if (entry == NULL && data.found_prefix)
-      return NULL;
-
   /* Not ever class library necessarily specifies a correct c_prefix,
    * so take a second pass. This time we will try a global lookup,
    * ignoring prefixes.


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