add EINA_VALUE_EMPTY, allow flushing empty values.

EINA_VALUE_EMPTY is basically a zeroed Eina_Value, handy for declaring
and returning.

To cope with the rest of efl, free/del/flush on NULL shouldn't
complain, so flusing an empty value should be quiet.
This commit is contained in:
Gustavo Sverzut Barbieri 2017-08-23 17:24:52 -03:00
parent 95f59ecd51
commit 4da53492ae
2 changed files with 11 additions and 0 deletions

View File

@ -136,6 +136,7 @@ eina_value_flush(Eina_Value *value)
const Eina_Value_Type *type;
void *mem;
if (!value || !value->type) return;
EINA_VALUE_TYPE_CHECK_RETURN(value);
type = value->type;

View File

@ -304,6 +304,16 @@
*/
typedef struct _Eina_Value Eina_Value;
/**
* @def EINA_VALUE_EMPTY
*
* This is simply a value with all memory zeroed. It may be used
* to safely initialize or return a value without a type.
*
* @since 1.21
*/
#define EINA_VALUE_EMPTY ((Eina_Value){ 0 })
/**
* @typedef Eina_Value_Type
* Describes the data contained by the value.