summaryrefslogtreecommitdiff
path: root/src/lib/eina
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-04-18 09:28:31 -0700
committerCedric BAIL <cedric.bail@free.fr>2019-04-26 11:32:40 -0700
commit805128dbf38483ae6bd9ef531b4e002d564ca391 (patch)
tree3d0b2bf95313b53171c205eeede608a6e241709e /src/lib/eina
parentc95662cbab15ba239ec26067326ef36e1f5c41d1 (diff)
eina: allow copy of EINA_VALUE_EMPTY type.
This is usefule to allow timeout future to be propagated through eina_future_all or eina_future_race for example. Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es> Differential Revision: https://phab.enlightenment.org/D8655
Diffstat (limited to 'src/lib/eina')
-rw-r--r--src/lib/eina/eina_value.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/eina/eina_value.c b/src/lib/eina/eina_value.c
index dbf6f48d9c..c75a5f1235 100644
--- a/src/lib/eina/eina_value.c
+++ b/src/lib/eina/eina_value.c
@@ -58,6 +58,7 @@ static Eina_Hash *_eina_value_inner_mps = NULL;
58static Eina_Lock _eina_value_inner_mps_lock; 58static Eina_Lock _eina_value_inner_mps_lock;
59static char *_eina_value_mp_choice = NULL; 59static char *_eina_value_mp_choice = NULL;
60static int _eina_value_log_dom = -1; 60static int _eina_value_log_dom = -1;
61static const Eina_Value _eina_value_empty = EINA_VALUE_EMPTY;
61 62
62#ifdef ERR 63#ifdef ERR
63#undef ERR 64#undef ERR
@@ -3954,6 +3955,7 @@ _eina_value_type_value_vset(const Eina_Value_Type *type EINA_UNUSED, void *mem,
3954{ 3955{
3955 Eina_Value *dst = mem; 3956 Eina_Value *dst = mem;
3956 Eina_Value src = va_arg(args, Eina_Value); 3957 Eina_Value src = va_arg(args, Eina_Value);
3958
3957 return eina_value_copy(&src, dst); 3959 return eina_value_copy(&src, dst);
3958} 3960}
3959 3961
@@ -3962,6 +3964,7 @@ _eina_value_type_value_pset(const Eina_Value_Type *type EINA_UNUSED, void *mem,
3962{ 3964{
3963 Eina_Value *dst = mem; 3965 Eina_Value *dst = mem;
3964 const Eina_Value *src = ptr; 3966 const Eina_Value *src = ptr;
3967
3965 return eina_value_copy(src, dst); 3968 return eina_value_copy(src, dst);
3966} 3969}
3967 3970
@@ -5591,9 +5594,7 @@ eina_value_new(const Eina_Value_Type *type)
5591 if (!value) return NULL; 5594 if (!value) return NULL;
5592 if (!type) 5595 if (!type)
5593 { 5596 {
5594 const Eina_Value empty = EINA_VALUE_EMPTY; 5597 memcpy(value, &_eina_value_empty, sizeof (_eina_value_empty));
5595
5596 memcpy(value, &empty, sizeof (empty));
5597 return value; 5598 return value;
5598 } 5599 }
5599 if (!eina_value_setup(value, type)) 5600 if (!eina_value_setup(value, type))
@@ -5622,6 +5623,13 @@ eina_value_copy(const Eina_Value *value, Eina_Value *copy)
5622 Eina_Bool ret; 5623 Eina_Bool ret;
5623 5624
5624 EINA_SAFETY_ON_NULL_RETURN_VAL(value, EINA_FALSE); 5625 EINA_SAFETY_ON_NULL_RETURN_VAL(value, EINA_FALSE);
5626
5627 if (!memcmp(value, &_eina_value_empty, sizeof (Eina_Value)))
5628 {
5629 memcpy(copy, &_eina_value_empty, sizeof (Eina_Value));
5630 return EINA_TRUE;
5631 }
5632
5625 EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_value_type_check(value->type), 5633 EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_value_type_check(value->type),
5626 EINA_FALSE); 5634 EINA_FALSE);
5627 EINA_SAFETY_ON_NULL_RETURN_VAL(copy, EINA_FALSE); 5635 EINA_SAFETY_ON_NULL_RETURN_VAL(copy, EINA_FALSE);