On Wed, Jan 11, 2012 at 4:52 AM, Lucas De Marchi
<lucas.demar...@profusion.mobi> wrote:
> On Wed, Jan 11, 2012 at 12:20 AM, Enlightenment SVN
> <no-re...@enlightenment.org> wrote:
>> Log:
>> add eina_value.
>>
>>  eina value is a generic value storage, it's quite efficient to space
>>  (16 bytes) and speed (inlines for basic types).
>>
>>  It's basically a structure describing how to manage memory
>>  (Eina_Value_Type), with default implementation for char, short, int,
>>  long, int64_t (and unsigned variants), float, double, stringshare and
>>  string.
>>
>>  If a type 'value_size' is smaller than 8 bytes, it's stored
>>  inline. Otherwise a value is allocated and managed.
>>
>>  Most of the methods are inline, with special handling for char, short,
>>  int... Then no extra calls are made, allowing the compiler to optimize
>>  them.
>>
>>  For array of a single type it is recommend to use Eina_Value_Array, as
>>  it will efficiently store and access members (just a char if subtype
>>  is EINA_VALUE_TYPE_CHAR, etc).
>>
>>  It can copy itself, compare itself. Including arrays.
>>
>>  It would be nice to have something that converts between EET and this.
>>
>>
>>
>> Author:       barbieri
>> Date:         2012-01-10 18:20:26 -0800 (Tue, 10 Jan 2012)
>> New Revision: 67035
>> Trac:         http://trac.enlightenment.org/e/changeset/67035
>>
>> Added:
>>  trunk/eina/src/include/eina_inline_value.x 
>> trunk/eina/src/include/eina_value.h trunk/eina/src/tests/eina_test_value.c
>> Modified:
>>  trunk/eina/ChangeLog trunk/eina/NEWS trunk/eina/src/include/Eina.h 
>> trunk/eina/src/include/Makefile.am trunk/eina/src/include/eina_inarray.h 
>> trunk/eina/src/lib/eina_inarray.c trunk/eina/src/lib/eina_main.c 
>> trunk/eina/src/lib/eina_value.c trunk/eina/src/tests/Makefile.am 
>> trunk/eina/src/tests/eina_suite.c trunk/eina/src/tests/eina_suite.h
>>
>> Modified: trunk/eina/ChangeLog
>> ===================================================================
>> --- trunk/eina/ChangeLog        2012-01-11 02:06:07 UTC (rev 67034)
>> +++ trunk/eina/ChangeLog        2012-01-11 02:20:26 UTC (rev 67035)
>> @@ -192,3 +192,4 @@
>>  2012-01-09  Gustavo Barbieri
>>
>>        * Add eina_inarray data type.
>> +       * Add eina_value data type (generic value storage).
>>
>> Modified: trunk/eina/NEWS
>> ===================================================================
>> --- trunk/eina/NEWS     2012-01-11 02:06:07 UTC (rev 67034)
>> +++ trunk/eina/NEWS     2012-01-11 02:20:26 UTC (rev 67035)
>> @@ -12,6 +12,7 @@
>>     * eina_file_map_faulted API
>>     * Xattr iterator for Eina_File : eina_file_xattr_get and 
>> eina_file_xattr_value_get API
>>     * Added eina_inarray data type
>> +    * Added eina_value data type (generic value storage)
>>
>>  Eina 1.1.0
>>
>>
>> Modified: trunk/eina/src/include/Eina.h
>> ===================================================================
>> --- trunk/eina/src/include/Eina.h       2012-01-11 02:06:07 UTC (rev 67034)
>> +++ trunk/eina/src/include/Eina.h       2012-01-11 02:20:26 UTC (rev 67035)
>> @@ -188,6 +188,7 @@
>>  #include "eina_refcount.h"
>>  #include "eina_mmap.h"
>>  #include "eina_xattr.h"
>> +#include "eina_value.h"
>>
>>  #ifdef __cplusplus
>>  }
>>
>> Modified: trunk/eina/src/include/Makefile.am
>> ===================================================================
>> --- trunk/eina/src/include/Makefile.am  2012-01-11 02:06:07 UTC (rev 67034)
>> +++ trunk/eina/src/include/Makefile.am  2012-01-11 02:20:26 UTC (rev 67035)
>> @@ -62,7 +62,9 @@
>>  eina_prefix.h \
>>  eina_refcount.h \
>>  eina_mmap.h \
>> -eina_xattr.h
>> +eina_xattr.h \
>> +eina_value.h \
>> +eina_inline_value.x
>>
>>  # Will be back for developper after 1.1.
>>  # eina_object.h
>>
>> Modified: trunk/eina/src/include/eina_inarray.h
>> ===================================================================
>> --- trunk/eina/src/include/eina_inarray.h       2012-01-11 02:06:07 UTC (rev 
>> 67034)
>> +++ trunk/eina/src/include/eina_inarray.h       2012-01-11 02:20:26 UTC (rev 
>> 67035)
>> @@ -272,6 +272,26 @@
>>                                       const void *data) EINA_ARG_NONNULL(1, 
>> 3);
>>
>>  /**
>> + * @brief Copy the data over the given position.
>> + * @param array array object
>> + * @param position where to replace the member
>> + * @param data data to be copied at position
>> + * @return #EINA_TRUE on success, #EINA_FALSE on failure.
>> + *
>> + * Copies the given pointer contents at the given @a position in the
>> + * array. The pointer is not referenced, instead it's contents is
>> + * copied to the members array using the previously defined
>> + * @c member_size.
>> + *
>> + * If @a position does not exist, it will fail.
>> + *
>> + * @since 1.2
>> + */
>> +EAPI Eina_Bool eina_inarray_replace_at(Eina_Inarray *array,
>> +                                       unsigned int position,
>> +                                       const void *data) 
>> EINA_ARG_NONNULL(1, 3);
>> +
>> +/**
>>  * @brief Remove member at given position
>>  * @param array array object
>>  * @param position position to be removed
>>
>> Modified: trunk/eina/src/lib/eina_inarray.c
>> ===================================================================
>> --- trunk/eina/src/lib/eina_inarray.c   2012-01-11 02:06:07 UTC (rev 67034)
>> +++ trunk/eina/src/lib/eina_inarray.c   2012-01-11 02:20:26 UTC (rev 67035)
>> @@ -523,6 +523,20 @@
>>  }
>>
>>  EAPI Eina_Bool
>> +eina_inarray_replace_at(Eina_Inarray *array, unsigned int position, const 
>> void *data)
>> +{
>> +   unsigned char *p;
>> +
>> +   EINA_MAGIC_CHECK_INARRAY(array, EINA_FALSE);
>> +   EINA_SAFETY_ON_TRUE_RETURN_VAL(position >= array->len, EINA_FALSE);
>> +
>> +   p = _eina_inarray_get(array, position);
>> +   memcpy(p, data, array->member_size);
>> +
>> +   return EINA_TRUE;
>> +}
>> +
>> +EAPI Eina_Bool
>>  eina_inarray_remove_at(Eina_Inarray *array, unsigned int position)
>>  {
>>    EINA_MAGIC_CHECK_INARRAY(array, EINA_FALSE);
>>
>> Modified: trunk/eina/src/lib/eina_main.c
>> ===================================================================
>> --- trunk/eina/src/lib/eina_main.c      2012-01-11 02:06:07 UTC (rev 67034)
>> +++ trunk/eina/src/lib/eina_main.c      2012-01-11 02:20:26 UTC (rev 67035)
>> @@ -68,6 +68,7 @@
>>  #include "eina_safety_checks.h"
>>  #include "eina_inlist.h"
>>  #include "eina_inarray.h"
>> +#include "eina_value.h"
>>
>>  /*============================================================================*
>>  *                                  Local                                    
>>  *
>> @@ -151,6 +152,7 @@
>>    S(simple_xml);
>>    S(file);
>>    S(prefix);
>> +   S(value);
>>  #undef S
>>
>>  struct eina_desc_setup
>> @@ -186,7 +188,8 @@
>>    S(quadtree),
>>    S(simple_xml),
>>    S(file),
>> -   S(prefix)
>> +   S(prefix),
>> +   S(value)
>>  #undef S
>>  };
>>  static const size_t _eina_desc_setup_len = sizeof(_eina_desc_setup) /
>>
>> Modified: trunk/eina/src/lib/eina_value.c
>> ===================================================================
>> --- trunk/eina/src/lib/eina_value.c     2012-01-11 02:06:07 UTC (rev 67034)
>> +++ trunk/eina/src/lib/eina_value.c     2012-01-11 02:20:26 UTC (rev 67035)
>> @@ -28,10 +28,2903 @@
>>  # include "config.h"
>>  #endif
>>
>> +/* _GNU_SOURCE: asprintf() */
>> +#ifndef _GNU_SOURCE
>> +#define _GNU_SOURCE
>> +#endif
>
> Humn... sounds like a thing that pertains to the build system:
>
> /* Enable GNU extensions on systems that have them.  */
> #ifndef _GNU_SOURCE
> # define _GNU_SOURCE 1
> #endif

config.h defines that macro... remove those lines

Vincent

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to