eo: implement a copy function.

we do not rely on copying the object, but on refcounting it. This seems
to match the usage we have with object.
This commit is contained in:
Cedric BAIL 2018-04-12 14:38:54 -07:00
parent 0c3508c2a2
commit 67d9c0c11e
1 changed files with 13 additions and 1 deletions

View File

@ -3445,13 +3445,25 @@ _eo_value_convert_to(const Eina_Value_Type *type EINA_UNUSED, const Eina_Value_T
return EINA_FALSE;
}
static Eina_Bool
_eo_value_copy(const Eina_Value_Type *type EINA_UNUSED, const void *mem, void *ptr)
{
Eo * const *src = mem;
Eo **dst = ptr;
if (!src || !dst) return EINA_FALSE;
*dst = efl_ref(*src);
return EINA_TRUE;
}
static const Eina_Value_Type _EINA_VALUE_TYPE_OBJECT = {
.version = EINA_VALUE_TYPE_VERSION,
.value_size = sizeof(Eo *),
.name = "Efl_Object",
.setup = _eo_value_setup,
.flush = _eo_value_flush,
.copy = NULL,
.copy = _eo_value_copy,
.compare = NULL,
.convert_to = _eo_value_convert_to,
.convert_from = NULL,