Commit Graph

27 Commits

Author SHA1 Message Date
Lucas De Marchi 0a4617ae38 FORMATTING
* Remove vim modelines:
 find . -name '*.[chx]' -exec sed -i '/\/\*$/ {N;N;/ \* vim:ts/d}' \{\} \;
 find . -name '*.[chx]' -exec sed -i '/\/[\*\/] *vim:/d' \{\} \;

* Remove leading blank lines:
 find . -name '*.[cxh]' -exec sed -i '/./,$!d'

If you use vim, use this in your .vimrc:
set ts=8 sw=3 sts=8 expandtab cino=>5n-3f0^-2{2(0W1st0



SVN revision: 50816
2010-08-04 16:57:32 +00:00
Cedric BAIL c9d5d8a62e * eina: add a way to move a key to another without triggering the Free_Cb.
SVN revision: 50683
2010-07-30 09:06:58 +00:00
Carsten Haitzler ddc6ba2c2a uncrustify eina.
SVN revision: 50573
2010-07-28 02:37:05 +00:00
Mike Blumenkrantz 2f183fa194 eina_hash_modify_or_add -> eina_hash_set
SVN revision: 50448
2010-07-23 13:04:21 +00:00
Mike Blumenkrantz 489cae4eee +eina_hash_modify_or_add to always add a value to the hash at the specified key
SVN revision: 50402
2010-07-21 03:15:39 +00:00
Mike Blumenkrantz d3982d4b5c +eina_hash_free_buckets to free buckets without freeing a hash
SVN revision: 50315
2010-07-18 04:24:24 +00:00
Gustavo Sverzut Barbieri 66ff799e5e Fix other EINA_PURE/EINA_CONST.
Some of them were working because they were inline, so the compiler
would know an just ignore the flag.

For lists and rbtree there is no problem as after each operation we
must change the pointer to the new head, thus the compiler will
consider it changed.



SVN revision: 46583
2010-02-27 15:17:15 +00:00
Cedric BAIL a9413206ef * eina_hash: First parameter could be NULL.
SVN revision: 43053
2009-10-13 17:11:58 +00:00
Gustavo Sverzut Barbieri e4af7c100c EINA API BREAK: no more individual modules init/shutdown.
Being able to indivually initialize individual modules was initially
"good", but at end it's putting complexities on users that would try
to "optimize" by doing just what they used, but in the end most people
would get them wrong, users would have to do lots of code and etc. At
the end it does not worth.

Most module init just register handful errors and log domains, so are
cheap. The exception is mempool users, that would dlopen() stuff, but
people that are concerned (embedded) can just compile those statically
in eina.

Since at the end any real application would use most of modules, we
actually end saving lots of function calls that would do nothing other
than increment a global counter.

I also did the init/shutdown use an array, making it easier to
maintain. The inital dependencies were analysed by a script I wrote, I
hope it's all right.

Please fix any breakages you find!



SVN revision: 42300
2009-09-06 22:21:56 +00:00
Cedric BAIL 6ca987941f * eina: Fix declaration according to Vincent Torri review.
SVN revision: 41359
2009-07-16 12:09:29 +00:00
Cedric BAIL 7a18ab5ebc * eina: Add an eina_hash_stringshare_new.
SVN revision: 41112
2009-06-19 14:44:23 +00:00
Gustavo Sverzut Barbieri 21f6be2f66 constness++
SVN revision: 39596
2009-03-20 01:00:04 +00:00
Gustavo Sverzut Barbieri ab95d9183d eina safety checks.
safety checks will report null pointers and other error conditions on
public api's and can be disabled by compile time check.

note that in order to have these checks working we need to make
EINA_ARG_NONNULL() void, otherwise GCC can remove these checks since
they're known to be false.

This commit also make two minor changes:

  * list and hash accessors and iterators are created even for empty
    entities. This is correct in my point of view since NULL should
    indicate error. Having these in were an optimziation, but not
    worth it, these are not the most common case and hitting this path
    is not of much cost.

 * unmarked some parameters as nonnull, mainly on list and inlist.



SVN revision: 38327
2008-12-26 18:31:14 +00:00
Gustavo Sverzut Barbieri b0ee5696a6 eina gets lots of gcc attributes to its api.
this should help with optimizations and code correctness, please see
"info gcc" for detailed explanation on these.

if you experience some functions not working as expected, please
double check if they're not marked with EINA_PURE or EINA_CONST, maybe
I misused them. Remove the macro and try again.

brief explanation:

 * EINA_WARN_UNUSED_RESULT: if you forgot to use the return of some
   function, it will emit a warning (and -Werror will make it an
   error). This way it will be harder to miss the attribution
   "l = eina_list_append(l, v)".

 * EINA_ARG_NONNULL(index, index...): if you give it an explicit NULL
   argument, or some tool (ie: clang) finds it could get a NULL but
   this is not accepted by API, then a warning will be emitted.  This
   will help those that still use eina_hash_add() as if it is
   evas_hash_add().

 * EINA_MALLOC: any non-NULL pointer it returns cannot alias any other
   pointer valid when function returns.

 * EINA_PURE: function have no effects other than the return and this
   return just depend on parameters and/or globals. You might call
   this function in a loop a thousand times and it will return the
   same value, thus you may move this function outside the loop and
   remove it.

 * EINA_CONST: stricter version of EINA_PURE, it will not check for
   global parameters, that is, you cannot consider pointer
   arguments. Use it for math things like "int sqrt(int)".

 * EINA_PRINTF(fmt, arg): will check format parameter specified in
   position "fmt" and passed arguments starting at position "arg", it
   will check for things like giving integers where short or strings
   were expected.

 * EINA_SCANF(fmt, arg): similar to eina_printf().

 * EINA_FORMAT(fmt): for use with things like dgettext(), it will get
   a printf-like format string and modifies it.

Please review and test it with your software, make sure you make clean
before you install the new version so it has any effect.

If you find some functions are missing EINA_WARN_UNUSED_RESULT and
EINA_ARG_NONNULL or others, please add them.



SVN revision: 38323
2008-12-26 13:17:51 +00:00
Cedric BAIL c80a55ee14 Add small bucket support.
SVN revision: 38168
2008-12-16 16:49:29 +00:00
Cedric BAIL 9b9f752379 Only allocate hash bucket when needed.
Make eina_hash_del_by_key really different from eina_hash_del.


SVN revision: 38064
2008-12-09 17:39:48 +00:00
Cedric BAIL af30207725 eina_hash_del must honor the data parameter when the key is passed. Propagate
it correctly.


SVN revision: 38054
2008-12-09 13:52:09 +00:00
Cedric BAIL 5358b1f84f Add integer and pointer hash table helper.
SVN revision: 38026
2008-12-08 17:31:55 +00:00
Gustavo Sverzut Barbieri b21c687f61 refactor eina_hash_del*, expose simpler functions and avoid GCC hack.
By using simpler functions for hash element deletion we can avoid the
hack to shut up GCC warking about hash_num not being used. As these
simple functions are more often needed than the catch-all, expose them
as well.



SVN revision: 37962
2008-12-06 06:58:56 +00:00
Gustavo Sverzut Barbieri f8868ffa96 Fix namespace: Eina_Foreach -> Eina_Hash_Foreach.
SVN revision: 37950
2008-12-06 02:21:17 +00:00
Cedric BAIL 550ebc9ab1 Add hash and rbtree delete callback, cleanup the code and improve performance (hash as a new internal structure).
We still need a hash function for removing a node from the hash and destroying it at the same time.



SVN revision: 36222
2008-09-24 17:14:29 +00:00
Vincent Torri f50feadeae * add benchmark and file documentation
* reorganize a bit more. it's not finished
 * fix spellingg and formatting 
 * gnuplot file names generated by our bechmarks tests have an
   absolute time description and not H:M:S description, as this
   breaks the check out of the repo on Windows.


SVN revision: 36090
2008-09-19 05:22:43 +00:00
Cedric BAIL 43cc2dca6f Add first try for an accessor and iterator API, comment welcome (lack inlist and list currently).
Rewrite EINA_ARRAY_ITER_NEXT, still fast, need one more parameter, but no more EINA_ARRAY_ITER_END.


SVN revision: 35438
2008-08-11 16:30:16 +00:00
Cedric BAIL ddaa7d4d8f License changes (BSD -> LGPL)
SVN revision: 35360
2008-08-06 18:15:24 +00:00
Cedric BAIL 69945bf4ec Major cleanup. Eina_Hash now support other key than string. All code except
allocation failure and foreach is covered by the test.


SVN revision: 35351
2008-08-06 15:46:57 +00:00
Cedric BAIL 86f58ba639 Use only the needed headers per file and remove some warning.
SVN revision: 35253
2008-07-30 13:35:49 +00:00
Cedric BAIL a92e3d6c83 Adding turran work to unify EFL data types and functions.
SVN revision: 35248
2008-07-30 12:46:55 +00:00