On Sat, Nov 4, 2017 at 6:29 PM, Cedric Bail <ced...@ddlm.me> wrote:
>> -------- Original Message --------
>> Subject: Re: [E-devel] [EGIT] [core/efl] master 01/03: eina: add a function 
>> return a reference to a copy of Eina_Value.
>> Local Time: November 4, 2017 7:56 AM
>> UTC Time: November 4, 2017 2:56 PM
>> From: barbi...@gmail.com
>> To: Enlightenment developer list <enlightenment-devel@lists.sourceforge.net>
>>
>> On Fri, Nov 3, 2017 at 8:36 PM, Cedric BAIL cedric.b...@free.fr wrote:
>>
>>> cedric pushed a commit to branch master.
>>> http://git.enlightenment.org/core/efl.git/commit/?id=e891a01749be7ff52a2937e1c08d90fc5f55808e
>>> commit e891a01749be7ff52a2937e1c08d90fc5f55808e
>>> Author: Cedric BAIL ced...@osg.samsung.com
>>> Date: Fri Nov 3 15:19:25 2017 -0700
>>>
>>> eina: add a function return a reference to a copy of Eina_Value.
>>>
>>> ---------------------------------------------------------------
>>>
>>> src/lib/eina/eina_inline_value_util.x | 16 ++++++++++++++++
>>> 1 file changed, 16 insertions(+)
>>> diff --git a/src/lib/eina/eina_inline_value_util.x 
>>> b/src/lib/eina/eina_inline_value_util.x
>>> index 3beca713fb..010465545f 100644
>>> --- a/src/lib/eina/eina_inline_value_util.x
>>> +++ b/src/lib/eina/eina_inline_value_util.x
>>> @@ -995,6 +995,22 @@ eina_value_dup(const Eina_Value *val)
>>> }
>>> /**
>>>
>>> -
>>>
>>> - @brief Return a reference to #Eina_Value containing a copy of the passed 
>>> parameter
>>>
>>> -
>>>
>>> - @param val The value to use
>>>
>>> -
>>>
>>> - @return The #Eina_Value
>>>
>>> -
>>>
>>> - @since 1.21
>>>
>>> - */
>>> +static inline Eina_Value
>>> +eina_value_reference_copy(const Eina_Value *val)
>>> +{
>>> - Eina_Value v = EINA_VALUE_EMPTY;
>>> -
>>>
>>> - eina_value_setup(&v, eina_value_type_get(val));
>>> - eina_value_copy(val, &v);
>>>
>>> should we detect copy failed and in that case flush v and return an empty 
>>> value?
>>>
>>> copy is deep-copy, it may need to walk thru arrays, lists and
>>> hashes... and some values may not provide copy, then it will fail.
>
> Right. Maybe actually return an Eina_Error actually ? Not sure which solution 
> is best actually. One let you have a chance to properly detect the error, but 
> force you to do it, while the other give you a place holder. I feel like 
> Eina_Error is best, but would prefer some feedback on it first.

could be an eina_error... doesn't leak and could end showing a
reasonable message somewhere (ie "to string")


-- 
Gustavo Sverzut Barbieri
--------------------------------------
Mobile: +55 (16) 99354-9890

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to