[gobject-introspection] Take into account the underscore after the type name when checking if a function is a method



commit 2cfb5774d7ae8aa32d7a3f722adaf8a9ff6fcd6d
Author: Tomeu Vizoso <tomeu sugarlabs org>
Date:   Thu May 6 11:57:37 2010 +0200

    Take into account the underscore after the type name when checking if a function is a method
    
    https://bugzilla.gnome.org/show_bug.cgi?id=617876

 gir/Everything-1.0-expected.gir |   27 +++++++++++++++++++++++++++
 gir/everything.c                |   18 ++++++++++++++++++
 gir/everything.h                |    3 +++
 giscanner/glibtransformer.py    |    2 +-
 4 files changed, 49 insertions(+), 1 deletions(-)
---
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir
index 168c8b2..4a15787 100644
--- a/gir/Everything-1.0-expected.gir
+++ b/gir/Everything-1.0-expected.gir
@@ -1612,6 +1612,33 @@ call and can be released on return.">
         </parameter>
       </parameters>
     </function>
+    <function name="test_object_null_in" c:identifier="test_object_null_in">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="obj"
+                   transfer-ownership="none"
+                   allow-none="1"
+                   doc="A #TestObj">
+          <type name="TestObj" c:type="TestObj*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="test_object_null_out" c:identifier="test_object_null_out">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="obj"
+                   direction="out"
+                   transfer-ownership="full"
+                   allow-none="1"
+                   doc="A #TestObj">
+          <type name="TestObj" c:type="TestObj**"/>
+        </parameter>
+      </parameters>
+    </function>
     <function name="test_short" c:identifier="test_short">
       <return-value transfer-ownership="none">
         <type name="short" c:type="gshort"/>
diff --git a/gir/everything.c b/gir/everything.c
index cee6a2b..08a8992 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -1777,6 +1777,24 @@ test_obj_do_matrix (TestObj *obj, const char *somestr)
   return TEST_OBJ_GET_CLASS (obj)->matrix (obj, somestr);
 }
 
+/**
+ * test_object_null_in:
+ * @obj: (allow-none) A #TestObj
+ */
+void
+test_object_null_in (TestObj *obj)
+{
+}
+
+/**
+ * test_object_null_out:
+ * @obj: (allow-none) (out) A #TestObj
+ */
+void
+test_object_null_out (TestObj **obj)
+{
+}
+
 typedef struct _CallbackInfo CallbackInfo;
 
 struct _CallbackInfo
diff --git a/gir/everything.h b/gir/everything.h
index 395d142..3b9e264 100644
--- a/gir/everything.h
+++ b/gir/everything.h
@@ -305,6 +305,9 @@ gboolean test_obj_torture_signature_1 (TestObj    *obj,
 /* virtual */
 int        test_obj_do_matrix (TestObj *obj, const char *somestr);
 
+void test_object_null_in (TestObj *obj);
+void test_object_null_out (TestObj **obj);
+
 /* inheritance */
 #define TEST_TYPE_SUB_OBJ           (test_sub_obj_get_type ())
 #define TEST_SUB_OBJECT(object)     (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_SUB_OBJ, TestSubObj))
diff --git a/giscanner/glibtransformer.py b/giscanner/glibtransformer.py
index cfde94b..ca43eb0 100644
--- a/giscanner/glibtransformer.py
+++ b/giscanner/glibtransformer.py
@@ -511,7 +511,7 @@ class GLibTransformer(object):
                     name_uscore = GET_TYPE_OVERRIDES.get(node.get_type,
                                                          node.get_type)
                     name_uscore = name_uscore[:-len('_get_type')]
-            name_offset = func.symbol.find(name_uscore)
+            name_offset = func.symbol.find(name_uscore + '_')
             if name_offset < 0:
                 return None
             prefix = func.symbol[:name_offset+len(name_uscore)]



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