Commit Graph

71 Commits

Author SHA1 Message Date
Lucas De Marchi 5a8a8c9014 Convert (hopefully) all comparisons to NULL
Apply badzero.cocci, badnull.coci and badnull2.cocci

This should convert all cases where there's a comparison to NULL to simpler
forms. This patch applies the following transformations:

code before patch               ||code after patch
===============================================================

return a == NULL;                 return !a;

return a != NULL;                 return !!a;

func(a == NULL);                  func(!a);

func(a != NULL);                  func(!!a);

b = a == NULL;                    b = !a;

b = a != NULL;                    b = !!a;

b = a == NULL ? c : d;            b = !a ? c : d;

b = a != NULL ? c : d;            b = a ? c : d;


other cases:

a == NULL                         !a
a != NULL                         a




SVN revision: 51487
2010-08-21 13:52:25 +00:00
Cedric BAIL e6f9cee051 * eina: fix structure content to be more futur proof and reduce
risk of ABI breakage.


SVN revision: 51390
2010-08-19 12:02:28 +00:00
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
Carsten Haitzler 15c71af0a5 fix formatting also
SVN revision: 50577
2010-07-28 03:03:25 +00:00
Carsten Haitzler bed21c315d errrr... hmmm why did this change?
SVN revision: 50574
2010-07-28 02:48:11 +00:00
Carsten Haitzler ddc6ba2c2a uncrustify eina.
SVN revision: 50573
2010-07-28 02:37:05 +00:00
Vincent Torri 247674b26c do not declare inlined functions in the source file,
fix a bit the doc of inlined functions

SVN revision: 49253
2010-05-28 19:03:26 +00:00
Vincent Torri c76d3cea37 remove useless semicolon
SVN revision: 48015
2010-04-15 06:28:22 +00:00
Christopher Michael 029111a9b8 Use different variable names. This was giving "shadowed declarations"
warnings during compile.



SVN revision: 45527
2010-01-24 19:51:22 +00:00
Cedric BAIL a9a3813966 * eina: Allow compilation with -Wshadow.
Patch from Albin Tonerre.


SVN revision: 45497
2010-01-23 19:53:27 +00:00
Vincent Torri 09d1853ea0 * finish benchmark tutorial
* move internal _init and _shutdown functions in the Global
   part of the code, as it is where they belong
 * fix minor documentation stuff


SVN revision: 44730
2009-12-27 08:45:30 +00:00
Jonathan Atton 6ea6dc0856 Eina : now eina stringshare is thread safe if eina_threads_init() is called. Eina log which was thread safe is now thread safe only if the previous functions is called
SVN revision: 43398
2009-11-01 19:50:18 +00:00
Jonathan Atton cc1863fc96 Eina: add eina_list_split_list()
SVN revision: 43307
2009-10-27 10:26:20 +00:00
Gustavo Sverzut Barbieri 8318f4c1f2 allow amalgamation of files, at least symbols don't clash anymore.
more related to amalgamation later.



SVN revision: 42312
2009-09-07 04:23:05 +00:00
Gustavo Sverzut Barbieri a4bd77905d malloc--: error and magic can take statically defined strings so no
need to strdup them.



SVN revision: 42311
2009-09-07 03:32:22 +00:00
Gustavo Sverzut Barbieri 404e3e09fb API BREAK: eina_magic_string_set() does not change existing strings anymore.
It's pointless to be able to change magic number string after it's
created, so let's avoid walking the existing list and just remove
places where strings were being duplicated (list/array both inited
magic strings for accessor/iterators).

Also an optimization, register using an array and sort it before
searching. Sort will just happen when array was changed, and this is
just done when eina_magic_string_get() is called.




SVN revision: 42310
2009-09-07 02:33:54 +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
Gustavo Sverzut Barbieri 8a2c84631c loggify list.
SVN revision: 42221
2009-09-04 01:43:50 +00:00
Gustavo Sverzut Barbieri 07d2bde900 eina_safety_checks_init()
All these individual init functions are getting messy, some modules
lack them and it's easy to get inconsistent. Safety check needs error
and log, but these need safety checks as well, some modules (lalloc,
rbtree and others) use safety checks but provide no _init().

I want to know if we really gain something to init individual
modules. It should not be that expensive as init should not allocate
heavy resources and the recommendation is to call eina_init() so most
users will do that anyway.

If people agree I'll unmark all *_init() as EAPI and make them private
to eina lib.



SVN revision: 42214
2009-09-04 00:53:19 +00:00
Vincent Torri 72b87160a2 * add eina_config.h in all source files. Fix linking with Visual Studio
* move eina_private.h and eina_safety_checks.h just after eina_config.h


SVN revision: 42077
2009-08-28 12:03:34 +00:00
Gustavo Sverzut Barbieri c8534587f2 do not check for data, eina_iterator_next/eina_accessor_data_get() does that.
SVN revision: 41984
2009-08-25 21:05:00 +00:00
Gustavo Sverzut Barbieri 425ebc47f5 improve docs and simplify macro, by kubo.
Kubo just found that docs could be improved and macro could be
simplified during his learning of EFL. Big bonus he did the
improvements =)



SVN revision: 41799
2009-08-16 00:47:23 +00:00
Rafael Antognolli a67732bb88 Fixed check at the start of eina_list_accessor_get_at.
SVN revision: 41634
2009-08-07 20:28:05 +00:00
Gustavo Sverzut Barbieri 7526d8e309 be more clear in docs.
SVN revision: 41629
2009-08-07 01:35:16 +00:00
Gustavo Sverzut Barbieri 944be7e745 Bugfix eina_list_search_sorted_near_list() add sorted_insert.
eina_list_search_sorted_near_list() was broken and barfed at my face
during development of eina_list_sorted_insert(), so I rewrote it
following more traditional approach, also adding special cases for
head/tail remembering that random access in lists is not as fast as
array. I also simplified that code.

eina_list_sorted_insert() should be fast, O(log2 n) insert, with
special cases to insert already sorted arrays forwards or backwards,
however I believe that it's better to simply append/prepend in those
cases (if known).



SVN revision: 41625
2009-08-06 22:31:45 +00:00
Gustavo Sverzut Barbieri 4f39f6861a API BREAK: eina_list_search_sorted_near_list() gets one more parameter.
This should not impact anybody, at least in SVN I got no hits for this
function.

The new parameter contains the result of the last call to func(), so
we can know if the node is smaller, bigger or exactly the requested
value and don't need to call func() on node to know for sure.



SVN revision: 41623
2009-08-06 19:01:47 +00:00
Gustavo Sverzut Barbieri 638e79b91e smarter eina_list_merge(), more tests.
eina_list_merge() now fixes the smallest list segment, not always the
right. Before if we joined a list 1 to 1000 segments we'd fix all the
1000 instead of the single at left.

Tests to make sure both code paths are being executed.



SVN revision: 41622
2009-08-06 18:35:53 +00:00
Gustavo Sverzut Barbieri aeef508b8a eina list docs.
* document undocumented functions.
 * note order of magnitude of each function, try to avoid users
   falling into traps.



SVN revision: 41619
2009-08-06 15:50:19 +00:00
Cedric BAIL e75b89d50c * eina: Handle NULL in eina_list_search_sorted_near_list.
SVN revision: 41467
2009-07-21 15:21:46 +00:00
Vincent Torri ebc20c2236 API BREAK: fix Eina API so that it is more consistent with the other EFL
what is modified:

eina_counter_add -> eina_counter_new
eina_counter_delete -> eina_counter_free
eina_lalloc_delete -> eina_lalloc_free
eina_mempool_new -> eina_mempool_add
eina_mempool_delete -> eina_mempool_del
eina_mempool_alloc -> eina_mempool_malloc
eina_tiler_del -> eina_tiler_free

It remains some questions: have the following API a good name:

eina_module_list_delete
eina_list_free
eina_rbtree_delete

(see ticket #286)

If you find any problem, please report in that thread


SVN revision: 41187
2009-06-24 16:56:49 +00:00
Vincent Torri 9110d8d574 fix a bit the documentation, but there are still
a lot of doc to write...


SVN revision: 41164
2009-06-22 20:03:58 +00:00
Vincent Torri 5bd14d2a05 * modify the way eina_config.h is built (see eina_config.h.in
and configure.ac)
 * include eina_config.h explicitely in files where the macros
   of eina_config.h are used
 * define eina_magic_string_init()  and eina_magic_string_shutdown()
   even when the mugle option is set (magic disabled)
 * formatting and fix in configure.ac


SVN revision: 40962
2009-06-08 08:27:33 +00:00
Cedric BAIL 5aeb9bbe82 * Fix some init/shutdown procedure.
SVN revision: 40892
2009-06-04 09:02:29 +00:00
Viktor Kojouharov b2eeca9783 fix docu
SVN revision: 39989
2009-04-11 16:59:39 +00:00
Vincent Torri bda0cab9dd fix llvm reports in eina_list
SVN revision: 39706
2009-03-25 09:24:56 +00:00
Vincent Torri 2b1fe0c3b9 change the variable near to lnear, as it seems
that it's a keyword on Windows...


SVN revision: 39621
2009-03-22 12:22:39 +00:00
Cedric BAIL e027bb8a6e * eina_list: Add a eina_list_search_sorted_near_list. Usefull if you want to build
a sorted list.


SVN revision: 39550
2009-03-18 15:00:52 +00:00
Cedric BAIL 9fab9595b5 * eina_list: Add eina_list_search_sorted_list and eina_list_search_unsorted_list.
SVN revision: 39546
2009-03-18 13:29:36 +00:00
Gustavo Sverzut Barbieri 56d1e979ce fix docs and add clone and reversed iterator calls.
* docs: be clear if it's a copy or in-place.

 * clone: add some apis to create a copy while operates, sort should
   do the same.

 * reversed iterator: new call to walk the list reversed, will make
   life easier in some cases.



SVN revision: 39515
2009-03-17 12:52:38 +00:00
Gustavo Sverzut Barbieri e3cce7b79d New macros, documentation and consistency for iterators and accessors.
EINA_ITERATOR_FOREACH() and EINA_ACCESSOR_FOREACH() are new macros to
help us forget about nasty C details (like cast to (void **)).

Document most iterators and accessors.

All iterators now set EINA_ERROR_OUT_OF_MEMORY if it's the case.



SVN revision: 39267
2009-02-27 16:32:22 +00:00
Cedric BAIL e31b5e961e * eina/src/lib/eina_list.c: Use less code.
* eina/src/lib/eina_error.c: Add a way to abord on any error message.



SVN revision: 39196
2009-02-25 10:46:14 +00:00
Cedric BAIL 1caa0562ad Add new set of usefull fonctions for eina list.
SVN revision: 38791
2009-01-26 14:46:02 +00:00
Cedric BAIL 0dda30daf6 * eina/src/include/eina_array.h,
* eina/src/include/eina_f16p16.h,
	* eina/src/include/eina_accessor.h,
	* eina/src/include/eina_list.h,
	* eina/src/include/eina_iterator.h,
	* eina/src/lib/eina_rectangle.c,
	* eina/src/lib/eina_list.c,
	* eina/src/lib/eina_array.c,
	* eina/src/lib/eina_hash.c,
	* eina/src/lib/eina_module.c,
	* eina/src/lib/eina_stringshare.c,
	* eina/src/lib/eina_benchmark.c: Fix for windows compilation.



SVN revision: 38663
2009-01-20 15:56:48 +00:00
tilman 4c70375594 Fixed two trivial const correctness issues.
SVN revision: 38621
2009-01-17 17:13:03 +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 09924b54e5 Let valgrind help with EINA_MAGIC.
Keep EINA_MAGIC at the end of the structure (WHEN POSSIBLE! Watch out
flexible arrays like char str[] at the end!)

this way if parts use EINA_MAGIC and others do not, it will possible overflow and valgrind can help us.

WARNING: make uninstall before update! Then make clean and make install, check if everything is working with "make check".



SVN revision: 37961
2008-12-06 06:53:14 +00:00
Carsten Haitzler 84f8c174bf fix list accounting on sort! bad - how did this hide for so long?
SVN revision: 37951
2008-12-06 02:51:04 +00:00
Carsten Haitzler 9f157c260c error macro.
SVN revision: 37323
2008-10-29 23:41:55 +00:00
Carsten Haitzler b4f33c6358 add error catching and output if mempool alloc/init fails.
SVN revision: 37321
2008-10-29 23:12:56 +00:00
Davide Andreoli eacf00b6d7 small doxy fix
SVN revision: 37037
2008-10-24 00:37:09 +00:00