gobject-introspection r782 - in trunk: . docs girepository tests tools



Author: tko
Date: Wed Oct 22 14:02:02 2008
New Revision: 782
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=782&view=rev

Log:
Bug 557405 â Use 'allow-none' consistently

2008-10-22  Tommi Komulainen  <tommi komulainen iki fi>

	* docs/typelib-format.txt:
	* girepository/ginfo.c (g_arg_info_may_be_null):
	* girepository/girnode.c (g_ir_node_build_typelib):
	* girepository/girnode.h (struct _GIrNodeParam):
	* girepository/girparser.c (start_parameter):
	* girepository/girwriter.c (function_generate):
	* girepository/gtypelib.h (ArgBlob):
	* tests/errors.gir:
	* tests/function.gir:
	* tools/generate.c (write_callable_info): Use 'allow-none'
	consistently throughout

Modified:
   trunk/ChangeLog
   trunk/docs/typelib-format.txt
   trunk/girepository/ginfo.c
   trunk/girepository/girnode.c
   trunk/girepository/girnode.h
   trunk/girepository/girparser.c
   trunk/girepository/girwriter.c
   trunk/girepository/gtypelib.h
   trunk/tests/errors.gir
   trunk/tests/function.gir
   trunk/tools/generate.c

Modified: trunk/docs/typelib-format.txt
==============================================================================
--- trunk/docs/typelib-format.txt	(original)
+++ trunk/docs/typelib-format.txt	Wed Oct 22 14:02:02 2008
@@ -380,7 +380,7 @@
   guint          in                           : 1;
   guint          out                          : 1;
   guint          dipper                       : 1;
-  guint          null_ok                      : 1;
+  guint          allow_none                   : 1;
   guint          optional                     : 1;
   guint          transfer_ownership           : 1;
   guint          transfer_container_ownership : 1;
@@ -403,11 +403,12 @@
 dipper:   The parameter is a pointer to a struct or object that will 
           receive an output of the function. 
 
-null_ok:  Only meaningful for types which are passed as pointers.
+allow_none:
+          Only meaningful for types which are passed as pointers.
           For an in parameter, indicates if it is ok to pass NULL in, for 
           an out parameter, whether it may return NULL. Note that NULL is a 
-          valid GList and GSList value, thus null_ok will normally be set for 
-          parameters of these types.
+          valid GList and GSList value, thus allow_none will normally be set
+          for parameters of these types.
 
 optional:          
           For an out parameter, indicates that NULL may be passed in

Modified: trunk/girepository/ginfo.c
==============================================================================
--- trunk/girepository/ginfo.c	(original)
+++ trunk/girepository/ginfo.c	Wed Oct 22 14:02:02 2008
@@ -707,7 +707,7 @@
   GIBaseInfo *base = (GIBaseInfo *)info;
   ArgBlob *blob = (ArgBlob *)&base->typelib->data[base->offset];
   
-  return blob->null_ok;
+  return blob->allow_none;
 }
 
 GITransfer

Modified: trunk/girepository/girnode.c
==============================================================================
--- trunk/girepository/girnode.c	(original)
+++ trunk/girepository/girnode.c	Wed Oct 22 14:02:02 2008
@@ -1489,7 +1489,7 @@
 				 module, modules, strings, types,
 				 data, &signature, offset2);
 
-	blob2->may_return_null = function->result->null_ok;
+	blob2->may_return_null = function->result->allow_none;
 	blob2->caller_owns_return_value = function->result->transfer;
 	blob2->caller_owns_return_container = function->result->shallow_transfer;
 	blob2->reserved = 0;
@@ -1533,7 +1533,7 @@
 				 module, modules, strings, types,
 				 data, &signature, offset2);
 
-	blob2->may_return_null = function->result->null_ok;
+	blob2->may_return_null = function->result->allow_none;
 	blob2->caller_owns_return_value = function->result->transfer;
 	blob2->caller_owns_return_container = function->result->shallow_transfer;
 	blob2->reserved = 0;
@@ -1585,7 +1585,7 @@
 				 module, modules, strings, types,
 				 data, &signature, offset2);
 
-	blob2->may_return_null = signal->result->null_ok;
+	blob2->may_return_null = signal->result->allow_none;
 	blob2->caller_owns_return_value = signal->result->transfer;
 	blob2->caller_owns_return_container = signal->result->shallow_transfer;
 	blob2->reserved = 0;
@@ -1632,7 +1632,7 @@
 				 module, modules, strings, types,
 				 data, &signature, offset2);
 
-	blob2->may_return_null = vfunc->result->null_ok;
+	blob2->may_return_null = vfunc->result->allow_none;
 	blob2->caller_owns_return_value = vfunc->result->transfer;
 	blob2->caller_owns_return_container = vfunc->result->shallow_transfer;
 	blob2->reserved = 0;
@@ -1661,7 +1661,7 @@
  	blob->in = param->in;
  	blob->out = param->out;
  	blob->dipper = param->dipper;
-	blob->null_ok = param->null_ok;
+	blob->allow_none = param->allow_none;
 	blob->optional = param->optional;
 	blob->transfer_ownership = param->transfer;
 	blob->transfer_container_ownership = param->shallow_transfer;

Modified: trunk/girepository/girnode.h
==============================================================================
--- trunk/girepository/girnode.h	(original)
+++ trunk/girepository/girnode.h	Wed Oct 22 14:02:02 2008
@@ -136,7 +136,7 @@
   gboolean dipper;
   gboolean optional;
   gboolean retval;
-  gboolean null_ok;
+  gboolean allow_none;
   gboolean transfer;
   gboolean shallow_transfer;
   

Modified: trunk/girepository/girparser.c
==============================================================================
--- trunk/girepository/girparser.c	(original)
+++ trunk/girepository/girparser.c	Wed Oct 22 14:02:02 2008
@@ -699,7 +699,7 @@
   const gchar *retval;
   const gchar *dipper;
   const gchar *optional;
-  const gchar *nullok;
+  const gchar *allow_none;
   const gchar *transfer;
   GIrNodeParam *param;
       
@@ -712,7 +712,7 @@
   retval = find_attribute ("retval", attribute_names, attribute_values);
   dipper = find_attribute ("dipper", attribute_names, attribute_values);
   optional = find_attribute ("optional", attribute_names, attribute_values);
-  nullok = find_attribute ("null-ok", attribute_names, attribute_values);
+  allow_none = find_attribute ("allow-none", attribute_names, attribute_values);
   transfer = find_attribute ("transfer-ownership", attribute_names, attribute_values);
 
   if (name == NULL)
@@ -756,10 +756,10 @@
   else
     param->optional = FALSE;
 
-  if (nullok && strcmp (nullok, "1") == 0)
-    param->null_ok = TRUE;
+  if (allow_none && strcmp (allow_none, "1") == 0)
+    param->allow_none = TRUE;
   else
-    param->null_ok = FALSE;
+    param->allow_none = FALSE;
 
   parse_param_transfer (param, transfer);
 

Modified: trunk/girepository/girwriter.c
==============================================================================
--- trunk/girepository/girwriter.c	(original)
+++ trunk/girepository/girwriter.c	Wed Oct 22 14:02:02 2008
@@ -183,9 +183,9 @@
 	    g_string_append (markup_s,
 			   g_markup_printf_escaped (" transfer=\"full\""));
 
-	  if (param->null_ok)
+	  if (param->allow_none)
 	    g_string_append (markup_s,
-			     g_markup_printf_escaped (" null-ok=\"1\""));
+			     g_markup_printf_escaped (" allow-none=\"1\""));
 	  
 	  if (strcmp (direction, "in") != 0)
 	    g_string_append (markup_s,

Modified: trunk/girepository/gtypelib.h
==============================================================================
--- trunk/girepository/gtypelib.h	(original)
+++ trunk/girepository/gtypelib.h	Wed Oct 22 14:02:02 2008
@@ -127,7 +127,7 @@
   guint          in                           : 1;
   guint          out                          : 1;
   guint          dipper                       : 1;
-  guint          null_ok                      : 1;
+  guint          allow_none                   : 1;
   guint          optional                     : 1;
   guint          transfer_ownership           : 1;
   guint          transfer_container_ownership : 1;

Modified: trunk/tests/errors.gir
==============================================================================
--- trunk/tests/errors.gir	(original)
+++ trunk/tests/errors.gir	Wed Oct 22 14:02:02 2008
@@ -17,7 +17,7 @@
     <function name="test1" symbol="test1">
       <return-type type="gboolean" />
       <parameters>
-        <parameter name="p1" type="gint" direction="in" null-ok="1" />
+        <parameter name="p1" type="gint" direction="in" allow-none="1" />
         <parameter name="p2" type="GError<Errors1,Errors2>*" transfer="full" direction="out" />
       </parameters>
     </function>

Modified: trunk/tests/function.gir
==============================================================================
--- trunk/tests/function.gir	(original)
+++ trunk/tests/function.gir	Wed Oct 22 14:02:02 2008
@@ -9,14 +9,14 @@
     <function name="test1" symbol="test1" deprecated="1">
       <return-type type="gboolean" />
       <parameters>
-        <parameter name="p1" type="Boxed1*" transfer="full" direction="in" null-ok="1" />
+        <parameter name="p1" type="Boxed1*" transfer="full" direction="in" allow-none="1" />
         <parameter name="p2" type="gboolean" direction="out" />
       </parameters>
     </function>
     <callback name="callback1" deprecated="1">
       <return-type type="gboolean" />
       <parameters>
-        <parameter name="p1" type="Boxed1*" transfer="full" direction="in" null-ok="1" />
+        <parameter name="p1" type="Boxed1*" transfer="full" direction="in" allow-none="1" />
         <parameter name="p2" type="gboolean" direction="out" />
       </parameters>
     </callback>

Modified: trunk/tools/generate.c
==============================================================================
--- trunk/tools/generate.c	(original)
+++ trunk/tools/generate.c	Wed Oct 22 14:02:02 2008
@@ -400,7 +400,7 @@
     }
   
   if (g_callable_info_may_return_null (info))
-    xml_printf (file, " null-ok=\"1\"");
+    xml_printf (file, " allow-none=\"1\"");
 
   write_type_info (namespace, type, file);
 
@@ -445,7 +445,7 @@
 	}
       
       if (g_arg_info_may_be_null (arg))
-	xml_printf (file, " null-ok=\"1\"");
+	xml_printf (file, " allow-none=\"1\"");
       
       if (g_arg_info_is_dipper (arg))
 	xml_printf (file, " dipper=\"1\"");



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