gobject-introspection r778 - in trunk: . girepository
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r778 - in trunk: . girepository
- Date: Tue, 21 Oct 2008 18:41:36 +0000 (UTC)
Author: walters
Date: Tue Oct 21 18:41:36 2008
New Revision: 778
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=778&view=rev
Log:
Respect path ordering for unversioned requires
Modified:
trunk/ChangeLog
trunk/girepository/girepository.c
Modified: trunk/girepository/girepository.c
==============================================================================
--- trunk/girepository/girepository.c (original)
+++ trunk/girepository/girepository.c Tue Oct 21 18:41:36 2008
@@ -858,6 +858,7 @@
struct NamespaceVersionCandidadate
{
GMappedFile *mfile;
+ int path_index;
char *path;
char *version;
};
@@ -867,12 +868,24 @@
struct NamespaceVersionCandidadate *c2)
{
int result = compare_version (c1->version, c2->version);
+ /* First, check the version */
if (result > 0)
return -1;
else if (result < 0)
return 1;
- else
- return 0;
+ else
+ {
+ /* Now check the path index, which says how early in the search path
+ * we found it. This ensures that of equal version targets, we
+ * pick the earlier one.
+ */
+ if (c1->path_index == c2->path_index)
+ return 0;
+ else if (c1->path_index > c2->path_index)
+ return 1;
+ else
+ return -1;
+ }
}
static void
@@ -895,13 +908,15 @@
char *namespace_typelib;
GSList *candidates = NULL;
GMappedFile *result = NULL;
+ int index;
*version_ret = NULL;
*path_ret = NULL;
namespace_dash = g_strdup_printf ("%s-", namespace);
namespace_typelib = g_strdup_printf ("%s.typelib", namespace);
-
+
+ index = 0;
for (ldir = search_path; ldir; ldir = ldir->next)
{
GDir *dir;
@@ -947,11 +962,13 @@
}
candidate = g_new0 (struct NamespaceVersionCandidadate, 1);
candidate->mfile = mfile;
+ candidate->path_index = index;
candidate->path = path;
candidate->version = version;
candidates = g_slist_prepend (candidates, candidate);
}
g_dir_close (dir);
+ index++;
}
if (candidates != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]