Commit Graph

20 Commits

Author SHA1 Message Date
Cedric BAIL fa1569eb9b eina: avoid wrong implicit conversion from unsigned to unsigned long in Eina_Value tests
There is no automatic promotion of unsigned to unsigned long when using va_arg,
which means it is illegal to pass an 'unsigned' value and then use it as an
unsigned long in eina_arg_vset. Doing so yields incorrect results on some
architectures like itanium

Patch by  Albin 'Lutin' Tonnerre <albin.tonnerre@gmail.com>



SVN revision: 71196
2012-05-17 09:59:46 +00:00
Cedric BAIL d80dae3035 eina: fix Eina_Inarray API to at least match Eina_Array API.
NOTE: some of this function should be moved as inline, but that's to late for a change
I think. So we will fix that if needed.

Second point, I am not happy with is eina_inarray_insert and eina_inarray_insert_at. The
naming is really poor.


SVN revision: 70352
2012-04-20 08:30:59 +00:00
Cedric BAIL c8412af437 eina: forgotten disable of eina_model.
SVN revision: 70348
2012-04-20 07:32:36 +00:00
Raphael Kubo da Costa 37efb6c4db Eina: Add eina_value_array_value_get().
Since k-s is on the road this days, we'd better write some code ourselves.
This is array counterpart of eina_value_struct_value_get(), and retrieves
an item from an Eina_Value_Array as an Eina_Value.

Code writing the setter is welcome.

Patch by: "Raphael Kubo da Costa" <kubo@profusion.mobi>


SVN revision: 68581
2012-03-01 17:15:54 +00:00
Gustavo Sverzut Barbieri 1fc6b13d10 eina_value: break usage, but makes it more uniform and correct.
I did a bad decision to steal memory for Array, List, Hash and Struct
types, it was nice to not have to copy it internally, but breaks when
one needs to set a new value that was set elsewhere. What did not
happen with string, integers and other basic types.

This was exposed by Raphael Kubo using eina_model_property_set() with
complex types (Array, List and Hash) and it was not possible to
correctly set such properties.

Now it's all set, but the behavior changed and the memory is not
stolen and released anymore. Test eina_test_value.c was changed to
reflect it.



SVN revision: 67843
2012-02-11 00:34:25 +00:00
Gustavo Sverzut Barbieri 63cc1bceea fix test leaks
SVN revision: 67836
2012-02-10 20:39:27 +00:00
Gustavo Sverzut Barbieri 948ce4b9ec eina_value: add EINA_VALUE_TYPE_MODEL
SVN revision: 67637
2012-01-31 16:45:59 +00:00
Gustavo Sverzut Barbieri 3683b0e719 eina_value_struct_member_value: helper to be used by esql and possibly others.
It is common to already known the member, then no need to query
it. This provides optimized retrieval for people that can manage it.



SVN revision: 67538
2012-01-25 16:58:57 +00:00
Gustavo Sverzut Barbieri 91c925fc54 eina_value: add array of struct test.
works nice :-)


SVN revision: 67159
2012-01-12 23:31:42 +00:00
Gustavo Sverzut Barbieri b1feb2fe8c eina_value: add struct type.
efficient storage with named access, can specify compare, alloc, free
and other operations for even better management.

no changelog/news as this is under eina_value, all new for 1.2 release.



SVN revision: 67155
2012-01-12 22:58:31 +00:00
Gustavo Sverzut Barbieri 32392d38f8 eina_value_blob: nicer convertion from string, array and blob.
SVN revision: 67154
2012-01-12 19:39:16 +00:00
Gustavo Sverzut Barbieri 9214ac6015 eina_value: hash now adopts given Eina_Hash.
This should allow users to setup the hash manually, in an efficient
way, then make it an Eina_Value.



SVN revision: 67147
2012-01-12 17:27:53 +00:00
Gustavo Sverzut Barbieri 47b08d1a16 eina_value: list now adopts given Eina_List.
This should allow users to setup the array manually, in an efficient
way, then make it an Eina_Value.


SVN revision: 67146
2012-01-12 17:15:49 +00:00
Gustavo Sverzut Barbieri d5de2617e0 eina_value: array now adopts given Eina_Inarray.
This should allow users to setup the array manually, in an efficient
way, then make it an Eina_Value.



SVN revision: 67145
2012-01-12 17:07:07 +00:00
Gustavo Sverzut Barbieri 113d35f6da eina_value: add blob type.
Nice type that even supports configurable operations such as compare,
free, copy and to_string.

the usual is also supported: provide no ops (operations) and memory
will be left untouched.

nice feature to dump as string :-)



SVN revision: 67109
2012-01-12 03:00:03 +00:00
Gustavo Sverzut Barbieri a125108ebe eina_value: add struct timeval.
may be useful for esskyuehl.



SVN revision: 67106
2012-01-12 01:31:21 +00:00
Gustavo Sverzut Barbieri 4e74c624d8 eina_value: add hash.
Similar to list and array, but takes string keys instead of position.

It can convert to string, I've added tests for it, but hash algorithm
changes may break the simple comparison I did... and I don't want to
parse the string to be more accurate.



SVN revision: 67103
2012-01-11 23:54:35 +00:00
Gustavo Sverzut Barbieri 0b2ddbd396 eina_value: revert bogus array change, add test.
oops! the list commit changed array back! I blame svn not having "git add -p"
and I have to do it by coping files :-/



SVN revision: 67097
2012-01-11 21:55:48 +00:00
Gustavo Sverzut Barbieri 16c03cc014 eina_value: add list type.
Similar to array, but less efficient as uses list nodes. If possible
values are stored on list->data itself, otherwise they are allocated
and the pointer goes as list->data.



SVN revision: 67096
2012-01-11 21:52:32 +00:00
Gustavo Sverzut Barbieri 7a4e904566 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.



SVN revision: 67035
2012-01-11 02:20:26 +00:00