static GIRepository *default_repository = NULL;
static GSList *search_path = NULL;
-static GSList *override_search_path = NULL;
struct _GIRepositoryPrivate
{
type_lib_path_env = g_getenv ("GI_TYPELIB_PATH");
search_path = NULL;
- override_search_path = NULL;
if (type_lib_path_env)
{
gchar **custom_dirs;
d = custom_dirs;
while (*d)
{
- override_search_path = g_slist_prepend (override_search_path, *d);
+ search_path = g_slist_prepend (search_path, *d);
d++;
}
g_free (custom_dirs);
}
- if (override_search_path != NULL)
- override_search_path = g_slist_reverse (override_search_path);
-
libdir = GOBJECT_INTROSPECTION_LIBDIR;
typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
return search_path;
}
-static GSList *
-build_search_path_with_overrides (void)
-{
- GSList *result;
-
- init_globals ();
-
- if (override_search_path != NULL)
- {
- result = g_slist_copy (override_search_path);
- g_slist_last (result)->next = g_slist_copy (search_path);
- }
- else
- result = g_slist_copy (search_path);
- return result;
-}
-
static char *
build_typelib_key (const char *name, const char *source)
{
const gchar *namespace_)
{
GList *ret = NULL;
- GSList *search_path;
GSList *candidates, *link;
const gchar *loaded_version;
- search_path = build_search_path_with_overrides ();
+ init_globals ();
candidates = enumerate_namespace_versions (namespace_, search_path);
- g_slist_free (search_path);
for (link = candidates; link; link = link->next)
{
GIRepositoryLoadFlags flags,
GError **error)
{
- GSList *search_path;
GITypelib *typelib;
- search_path = build_search_path_with_overrides ();
+ init_globals ();
typelib = require_internal (repository, namespace, version, flags,
search_path, error);
- g_slist_free (search_path);
return typelib;
}