Support (out caller-allocates)

People have wanted support for marking (out) on functions of the
form:

/**
 * clutter_color_from_pixel:
 * @pixel: A pixel
 * @color: (out): Color to initialize with value of @pixel
 */
void
clutter_color_from_pixel (guint32 pixel, ClutterColor *color);

Where the caller is supposed to have allocated the argument; the
C function just initializes it.  This patch adds support for this
argument passing style to introspection.  In this case, we see the
(out), and notice that there's only a single indirection (*) on
the argument, and assume that this means (out caller-allocates).

https://bugzilla.gnome.org/show_bug.cgi?id=604749
This commit is contained in:
Colin Walters 2009-12-16 11:47:19 -05:00 committed by Philip Withnall
parent 320dd66c62
commit ecd9c2f3e7

View File

@ -479,7 +479,8 @@ write_callable_info (const gchar *namespace,
case GI_DIRECTION_IN:
break;
case GI_DIRECTION_OUT:
xml_printf (file, " direction=\"out\"");
xml_printf (file, " direction=\"out\" caller-allocates=\"%s\"",
g_arg_info_is_caller_allocates (arg) ? "1" : "0");
break;
case GI_DIRECTION_INOUT:
xml_printf (file, " direction=\"inout\"");
@ -489,9 +490,6 @@ write_callable_info (const gchar *namespace,
if (g_arg_info_may_be_null (arg))
xml_printf (file, " allow-none=\"1\"");
if (g_arg_info_is_dipper (arg))
xml_printf (file, " dipper=\"1\"");
if (g_arg_info_is_return_value (arg))
xml_printf (file, " retval=\"1\"");