value: allow multiple flush.

multiple flush may happen when handling errors. May be used in some cases.




SVN revision: 67839
This commit is contained in:
Gustavo Sverzut Barbieri 2012-02-10 21:34:28 +00:00
parent 0d1b66d44e
commit edfd15d9ca
1 changed files with 15 additions and 2 deletions

View File

@ -2249,7 +2249,11 @@ static Eina_Bool
_eina_value_type_stringshare_flush(const Eina_Value_Type *type __UNUSED__, void *mem)
{
const char **tmem = mem;
if (*tmem) eina_stringshare_del(*tmem);
if (*tmem)
{
eina_stringshare_del(*tmem);
*tmem = NULL;
}
return EINA_TRUE;
}
@ -2281,7 +2285,11 @@ static Eina_Bool
_eina_value_type_string_flush(const Eina_Value_Type *type __UNUSED__, void *mem)
{
char **tmem = mem;
if (*tmem) free(*tmem);
if (*tmem)
{
free(*tmem);
*tmem = NULL;
}
return EINA_TRUE;
}
@ -3573,6 +3581,8 @@ _eina_value_type_blob_flush(const Eina_Value_Type *type __UNUSED__, void *mem)
Eina_Value_Blob *tmem = mem;
if ((ops) && (ops->free))
ops->free(ops, (void *)tmem->memory, tmem->size);
tmem->memory = NULL;
tmem->size = 0;
return EINA_TRUE;
}
@ -4003,6 +4013,9 @@ _eina_value_type_struct_flush(const Eina_Value_Type *type __UNUSED__, void *mem)
else
free(tmem->memory);
tmem->memory = NULL;
tmem->desc = NULL;
return ret;
}