[gobject-introspection] [everything] Allow passing NULL to the callback
- From: Johan Dahlin <johan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gobject-introspection] [everything] Allow passing NULL to the callback
- Date: Thu, 3 Dec 2009 21:18:22 +0000 (UTC)
commit 263af175f3630ac5c6b215e25d19bfb10a41253d
Author: Johan Dahlin <johan gnome org>
Date: Thu Dec 3 19:14:31 2009 -0200
[everything] Allow passing NULL to the callback
gir/Everything-1.0-expected.gir | 5 ++++-
gir/everything.c | 6 ++++--
2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir
index 7e3caae..2518a6d 100644
--- a/gir/Everything-1.0-expected.gir
+++ b/gir/Everything-1.0-expected.gir
@@ -656,7 +656,10 @@ case.">
<type name="int" c:type="int"/>
</return-value>
<parameters>
- <parameter name="callback" transfer-ownership="none" scope="call">
+ <parameter name="callback"
+ transfer-ownership="none"
+ allow-none="1"
+ scope="call">
<type name="TestCallback" c:type="TestCallback"/>
</parameter>
</parameters>
diff --git a/gir/everything.c b/gir/everything.c
index e73d8ca..563a05f 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -1515,13 +1515,15 @@ test_sub_obj_unset_bare (TestSubObj *obj)
/**
* test_callback:
- * @callback: (scope call):
+ * @callback: (scope call) (allow-none):
*
**/
int
test_callback (TestCallback callback)
{
- return callback();
+ if (callback != NULL)
+ return callback();
+ return 0;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]