backport ?

Vincent


On Tue, 31 May 2011, Enlightenment SVN wrote:

> Log:
> eina: fix eina_hash_set to act when data == NULL like eina_hash_del.
>
>
> Author:       cedric
> Date:         2011-05-31 09:43:40 -0700 (Tue, 31 May 2011)
> New Revision: 59849
> Trac:         http://trac.enlightenment.org/e/changeset/59849
>
> Modified:
>  trunk/eina/ChangeLog trunk/eina/src/include/eina_hash.h 
> trunk/eina/src/lib/eina_hash.c
>
> Modified: trunk/eina/ChangeLog
> ===================================================================
> --- trunk/eina/ChangeLog      2011-05-31 16:16:01 UTC (rev 59848)
> +++ trunk/eina/ChangeLog      2011-05-31 16:43:40 UTC (rev 59849)
> @@ -97,3 +97,7 @@
> 2011-05-30  Cedric Bail
>
>       * Add eina_condition_timedwait.
> +
> +2011-05-31  Cedric Bail
> +
> +     * Fix eina_hash_set to handle data == NULL like eina_hash_del.
>
> Modified: trunk/eina/src/include/eina_hash.h
> ===================================================================
> --- trunk/eina/src/include/eina_hash.h        2011-05-31 16:16:01 UTC (rev 
> 59848)
> +++ trunk/eina/src/include/eina_hash.h        2011-05-31 16:43:40 UTC (rev 
> 59849)
> @@ -379,7 +379,7 @@
>  */
> EAPI void *eina_hash_set(Eina_Hash  *hash,
>                          const void *key,
> -                         const void *data) EINA_ARG_NONNULL(1, 2, 3);
> +                         const void *data) EINA_ARG_NONNULL(1, 2);
>
> /**
>  * @brief Change the key associated with a data without triggering the
>
> Modified: trunk/eina/src/lib/eina_hash.c
> ===================================================================
> --- trunk/eina/src/lib/eina_hash.c    2011-05-31 16:16:01 UTC (rev 59848)
> +++ trunk/eina/src/lib/eina_hash.c    2011-05-31 16:43:40 UTC (rev 59849)
> @@ -1103,7 +1103,6 @@
>    EINA_SAFETY_ON_NULL_RETURN_VAL(hash,              NULL);
>    EINA_SAFETY_ON_NULL_RETURN_VAL(hash->key_hash_cb, NULL);
>    EINA_SAFETY_ON_NULL_RETURN_VAL(key,               NULL);
> -   EINA_SAFETY_ON_NULL_RETURN_VAL(data,              NULL);
>    EINA_MAGIC_CHECK_HASH(hash);
>
>    key_length = hash->key_length_cb ? hash->key_length_cb(key) : 0;
> @@ -1119,10 +1118,21 @@
>         void *old_data = NULL;
>
>         old_data = hash_element->tuple.data;
> -        hash_element->tuple.data = (void *)data;
> +
> +     if (data)
> +       {
> +         hash_element->tuple.data = (void *)data;
> +       }
> +     else
> +       {
> +         _eina_hash_del_by_hash_el(hash, hash_element, hash_head, key_hash);
> +       }
> +
>         return old_data;
>      }
>
> +   if (!data) return NULL;
> +
>    eina_hash_add_alloc_by_hash(hash,
>                                key,
>                                key_length,
>
>
> ------------------------------------------------------------------------------
> Simplify data backup and recovery for your virtual environment with vRanger.
> Installation's a snap, and flexible recovery options mean your data is safe,
> secure and there when you need it. Data protection magic?
> Nope - It's vRanger. Get your free trial download today.
> http://p.sf.net/sfu/quest-sfdev2dev
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>
>

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to