eina_value_stringshare: safer copy, to cope copying user-generated structs.
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 13 Feb 2012 16:18:47 +0000 (16:18 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 13 Feb 2012 16:18:47 +0000 (16:18 +0000)
array, list, struct and others set() now copies the values. These
values can be created by user, in this case string is just a stack
object and not a real eina_stringshare.

To cope with it, add the string instead of referencing it. Bit slower,
but nicer behavior.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@67886 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/eina_value.c

index 495aab9..8458afd 100644 (file)
@@ -2262,8 +2262,7 @@ _eina_value_type_stringshare_copy(const Eina_Value_Type *type __UNUSED__, const
 {
    const char * const*s = src;
    const char **d = dst;
-   *d = *s;
-   eina_stringshare_ref(*d);
+   *d = eina_stringshare_add(*s);
    return EINA_TRUE;
 }