[glib/wip/1615-gdbus-codgen-nullable] gdbus-codegen: Add missing nullable and optional g-i annotations to generated code



commit f77d762aec5a471971930ae2102fe1484b5d5c8a
Author: Michael Gratton <mike vee net>
Date:   Tue Dec 11 10:01:36 2018 +1100

    gdbus-codegen: Add missing nullable and optional g-i annotations to generated code
    
    Fixes #1615

 gio/gdbus-2.0/codegen/codegen.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py
index 9d2b904c7..ef1af6361 100644
--- a/gio/gdbus-2.0/codegen/codegen.py
+++ b/gio/gdbus-2.0/codegen/codegen.py
@@ -1558,7 +1558,7 @@ class CodeGenerator:
             if p.arg.free_func != None:
                 self.outfile.write(' * <warning>The returned value is only valid until the property changes 
so on the client-side it is only safe to use this function on the thread where @object was constructed. Use 
%s_dup_%s() if on another thread.</warning>\n'
                                    ' *\n'
-                                   ' * Returns: (transfer none): The property value or %%NULL if the 
property is not set. Do not free the returned value, it belongs to @object.\n'
+                                   ' * Returns: (transfer none) (nullable): The property value or %%NULL if 
the property is not set. Do not free the returned value, it belongs to @object.\n'
                                    %(i.name_lower, p.name_lower))
             else:
                 self.outfile.write(' * Returns: The property value.\n')
@@ -1580,7 +1580,7 @@ class CodeGenerator:
                         ' *\n'
                         ' * %s\n'
                         ' *\n'
-                        ' * Returns: (transfer full): The property value or %%NULL if the property is not 
set. The returned value should be freed with %s().\n'
+                        ' * Returns: (transfer full) (nullable): The property value or %%NULL if the 
property is not set. The returned value should be freed with %s().\n'
                         %(i.name_lower, p.name_lower, i.camel_name, i.name, p.name, hint, p.arg.free_func), 
False))
                 self.write_gtkdoc_deprecated_and_since_and_close(p, self.outfile, 0)
                 self.outfile.write('%s\n'
@@ -1716,9 +1716,9 @@ class CodeGenerator:
                                ' * @proxy: A #%sProxy.\n'
                                %(i.name_lower, m.name_lower, i.camel_name))
             for a in m.out_args:
-                self.outfile.write(' * @out_%s: (out)%s: Return location for return parameter or %%NULL to 
ignore.\n'%(a.name, ' ' + a.array_annotation if a.array_annotation else ''))
+                self.outfile.write(' * @out_%s: (out) (optional)%s: Return location for return parameter or 
%%NULL to ignore.\n'%(a.name, ' ' + a.array_annotation if a.array_annotation else ''))
             if unix_fd:
-                self.outfile.write(' * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL.\n')
+                self.outfile.write(' * @out_fd_list: (out) (optional): Return location for a #GUnixFDList or 
%NULL to ignore.\n')
             self.outfile.write(self.docbook_gen.expand(
                     ' * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to 
%s_call_%s().\n'
                     ' * @error: Return location for error or %%NULL.\n'
@@ -1771,7 +1771,7 @@ class CodeGenerator:
             if unix_fd:
                 self.outfile.write(' * @fd_list: (nullable): A #GUnixFDList or %NULL.\n')
             for a in m.out_args:
-                self.outfile.write(' * @out_%s: (out)%s: Return location for return parameter or %%NULL to 
ignore.\n'%(a.name, ' ' + a.array_annotation if a.array_annotation else ''))
+                self.outfile.write(' * @out_%s: (out) (optional)%s: Return location for return parameter or 
%%NULL to ignore.\n'%(a.name, ' ' + a.array_annotation if a.array_annotation else ''))
             if unix_fd:
                 self.outfile.write(' * @out_fd_list: (out): Return location for a #GUnixFDList or %NULL.\n')
             self.outfile.write(self.docbook_gen.expand(
@@ -3078,7 +3078,7 @@ class CodeGenerator:
                     ' *\n'
                     ' * Gets the #%s instance for the D-Bus interface #%s on @object, if any.\n'
                     ' *\n'
-                    ' * Returns: (transfer full): A #%s that must be freed with g_object_unref() or %%NULL 
if @object does not implement the interface.\n'
+                    ' * Returns: (transfer full) (nullable): A #%s that must be freed with g_object_unref() 
or %%NULL if @object does not implement the interface.\n'
                     %(self.ns_lower, i.name_upper.lower(), self.namespace, i.camel_name, i.name, 
i.camel_name), False))
             self.write_gtkdoc_deprecated_and_since_and_close(i, self.outfile, 0)
             self.outfile.write('%s *%sobject_get_%s (%sObject *object)\n'
@@ -3103,7 +3103,7 @@ class CodeGenerator:
                     ' *\n'
                     ' * <warning>It is not safe to use the returned object if you are on another thread than 
the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>\n'
                     ' *\n'
-                    ' * Returns: (transfer none): A #%s or %%NULL if @object does not implement the 
interface. Do not free the returned object, it is owned by @object.\n'
+                    ' * Returns: (transfer none) (nullable): A #%s or %%NULL if @object does not implement 
the interface. Do not free the returned object, it is owned by @object.\n'
                     %(self.ns_lower, i.name_upper.lower(), self.namespace, self.ns_lower, 
i.name_upper.lower(), i.camel_name), False))
             self.write_gtkdoc_deprecated_and_since_and_close(i, self.outfile, 0)
             self.outfile.write('%s *%sobject_peek_%s (%sObject *object)\n'


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