[gobject-introspection] Add a method to compare infos



commit 1a678c002f018df886aa9704f46aa1ad82498edc
Author: Simon van der Linden <svdlinden src gnome org>
Date:   Fri Jul 10 21:27:00 2009 +0200

    Add a method to compare infos
    
    Add g_base_info_equal.

 girepository/ginfo.c        |    7 +++++++
 girepository/girepository.h |    2 ++
 2 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/girepository/ginfo.c b/girepository/ginfo.c
index e7b0b8b..bb8f876 100644
--- a/girepository/ginfo.c
+++ b/girepository/ginfo.c
@@ -542,6 +542,13 @@ g_base_info_get_typelib (GIBaseInfo *info)
   return info->typelib;
 }
 
+gboolean
+g_base_info_equal (GIBaseInfo *info1, GIBaseInfo *info2)
+{
+  /* Note: TypeLibs are mmapped. */
+  return info1->typelib->data + info1->offset == info2->typelib->data + info2->offset;
+}
+
 /* GIFunctionInfo functions */
 const gchar *
 g_function_info_get_symbol (GIFunctionInfo *info)
diff --git a/girepository/girepository.h b/girepository/girepository.h
index 559be1e..1e1a52d 100644
--- a/girepository/girepository.h
+++ b/girepository/girepository.h
@@ -203,6 +203,8 @@ gboolean               g_base_info_iterate_attributes (GIBaseInfo      *info,
                                                        char          **value);
 GIBaseInfo *           g_base_info_get_container    (GIBaseInfo   *info);
 GTypelib *             g_base_info_get_typelib      (GIBaseInfo   *info);
+gboolean               g_base_info_equal            (GIBaseInfo   *info1,
+                                                     GIBaseInfo   *info2);
 
 GIBaseInfo *           g_info_new                   (GIInfoType    type,
 						     GIBaseInfo   *container,



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