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.



-- 
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