eina: make it possible to return an EINA_VALUE_EMPTY by just requesting a new value of type NULL.

This commit is contained in:
Cedric BAIL 2018-05-10 16:42:08 -07:00
parent 671fc92f08
commit 842b2ec381
1 changed files with 7 additions and 0 deletions

View File

@ -5589,6 +5589,13 @@ eina_value_new(const Eina_Value_Type *type)
{
Eina_Value *value = eina_mempool_malloc(_eina_value_mp, sizeof(Eina_Value));
if (!value) return NULL;
if (!type)
{
const Eina_Value empty = EINA_VALUE_EMPTY;
memcpy(value, &empty, sizeof (empty));
return value;
}
if (!eina_value_setup(value, type))
{
eina_mempool_free(_eina_value_mp, value);