eina_strbuf_append(buf, _get_add_star(ftype, eolian_parameter_direction_get(pr)));
eina_strbuf_append(buf, prn);
eina_stringshare_del(prtn);
+ if (eolian_type_is_owned(eolian_parameter_type_get(pr)))
+ eina_strbuf_append(buf, " EFL_TRANSFER_OWNERSHIP");
*rpid = 0;
return 1;
}
flagbuf = eina_strbuf_new();
eina_strbuf_prepend(flagbuf, " EINA_WARN_UNUSED_RESULT");
}
+ if (rtp && eolian_type_is_owned(rtp))
+ eina_strbuf_append(buf, " EFL_TRANSFER_OWNERSHIP");
if (flagbuf)
{
eina_strbuf_append(buf, eina_strbuf_string_get(flagbuf));
*/
typedef void (*Efl_Del_Intercept) (Eo *obj_id);
+/**
+ * This is a no-operation. Its presence behind a function parameter indicates that
+ * ownership of the parameter is transferred to the callee.
+ * When present after a method, it indicates that the return value of the method is
+ * transferred to the caller.
+ * For objects, ownership transfer means that exactly one reference is transferred.
+ * If you transfer ownership without owning a reference in the first place, you will
+ * get unexpected behavior.
+ * For non-Objects, ownership transfer means that the responsibility of freeing a
+ * segment of memory is passed on.
+ */
+#define EFL_TRANSFER_OWNERSHIP
+
#include "efl_object_override.eo.h"
#include "efl_object.eo.h"
* @return EINA_TRUE if the object is ownable. EINA_FALSE if not.
*/
EAPI Eina_Bool efl_ownable_get(const Eo *obj);
+
/**
* @}
*/
EOAPI void function_as_argument_set_cb(Eo *obj, void *cb_data, SimpleFunc cb, Eina_Free_Cb cb_free_cb);
-EOAPI char *function_as_argument_call_cb(Eo *obj, int a, double b);
+EOAPI char *function_as_argument_call_cb(Eo *obj, int a, double b) EFL_TRANSFER_OWNERSHIP;
#endif
typedef const char * (*SimpleFunc)(void *data, int a, double b);
-typedef double (*ComplexFunc)(void *data, const char *c, char **d);
+typedef double (*ComplexFunc)(void *data, const char *c, char **d EFL_TRANSFER_OWNERSHIP);
typedef void (*FuncAsArgFunc)(void *data, void *cb_data, VoidFunc cb, Eina_Free_Cb cb_free_cb, void *another_cb_data, SimpleFunc another_cb, Eina_Free_Cb another_cb_free_cb);
*
* @ingroup Struct
*/
-EOAPI char *struct_foo(Eo *obj, int idx);
+EOAPI char *struct_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP;
EOAPI Named *struct_bar(Eo *obj);
EWAPI const Efl_Class *typedef_class_get(void);
-EOAPI char *typedef_foo(Eo *obj, int idx);
+EOAPI char *typedef_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP;
#endif