gobject-introspection r816 - in trunk: . girepository tests/repository



Author: walters
Date: Sat Oct 25 15:48:50 2008
New Revision: 816
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=816&view=rev

Log:
Bug 557791 â g_irepository_require() could return a GTypelib *

Modified:
   trunk/ChangeLog
   trunk/girepository/girepository.c
   trunk/girepository/girepository.h
   trunk/tests/repository/gitestrepo.c

Modified: trunk/girepository/girepository.c
==============================================================================
--- trunk/girepository/girepository.c	(original)
+++ trunk/girepository/girepository.c	Sat Oct 25 15:48:50 2008
@@ -1029,9 +1029,9 @@
  * version @version of namespace may be specified.  If @version is
  * not specified, the latest will be used.
  *
- * Returns: %TRUE if successful, %NULL otherwise
+ * Returns: a pointer to the #GTypelib if successful, %NULL otherwise
  */
-gboolean
+GTypelib *
 g_irepository_require (GIRepository  *repository,
 		       const gchar   *namespace,
 		       const gchar   *version,
@@ -1039,7 +1039,7 @@
 		       GError       **error)
 {
   GMappedFile *mfile;
-  gboolean ret = FALSE;
+  GTypelib *ret = NULL;
   Header *header;
   GTypelib *typelib = NULL;
   const gchar *typelib_namespace, *typelib_version;
@@ -1053,9 +1053,10 @@
 
   repository = get_repository (repository);
 
-  if (get_registered_status (repository, namespace, version, allow_lazy, 
-			     &is_lazy, &version_conflict))
-    return TRUE;
+  typelib = get_registered_status (repository, namespace, version, allow_lazy, 
+                                   &is_lazy, &version_conflict);
+  if (typelib)
+    return typelib;
 
   if (version_conflict != NULL)
     {
@@ -1063,7 +1064,7 @@
 		   G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
 		   "Requiring namespace '%s' version '%s', but '%s' is already loaded",
 		   namespace, version, version_conflict);
-      return FALSE;
+      return NULL;
     }
 
   if (version != NULL)
@@ -1121,7 +1122,7 @@
       g_typelib_free (typelib);
       goto out;
     }
-  ret = TRUE;
+  ret = typelib;
  out:
   g_free (tmp_version);
   g_free (path);

Modified: trunk/girepository/girepository.h
==============================================================================
--- trunk/girepository/girepository.h	(original)
+++ trunk/girepository/girepository.h	Sat Oct 25 15:48:50 2008
@@ -87,7 +87,7 @@
 GIBaseInfo *  g_irepository_find_by_name  (GIRepository *repository,
 					   const gchar  *namespace,
 					   const gchar  *name);
-gboolean      g_irepository_require       (GIRepository *repository,
+GTypelib *    g_irepository_require       (GIRepository *repository,
 					   const gchar  *namespace,
 					   const gchar  *version,
 					   GIRepositoryLoadFlags flags,

Modified: trunk/tests/repository/gitestrepo.c
==============================================================================
--- trunk/tests/repository/gitestrepo.c	(original)
+++ trunk/tests/repository/gitestrepo.c	Sat Oct 25 15:48:50 2008
@@ -35,7 +35,7 @@
 main(int argc, char **argv)
 {
   GIRepository *repo;
-  gboolean ret;
+  GTypelib *ret;
   GError *error = NULL;
   GIBaseInfo *info;
   GType gtype;



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