Commit Graph

19 Commits

Author SHA1 Message Date
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
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
Gustavo Sverzut Barbieri 03fca99e56 Add safe Eina list walk function.
SVN revision: 37949
2008-12-06 02:13:01 +00:00
Vincent Torri c8e2f1f51f small doc fix
SVN revision: 37407
2008-11-02 09:41:14 +00:00
Cedric BAIL 430fb672cd Rename EINA_LIST_ITER_NEXT to EINA_LIST_FOREACH.
SVN revision: 36930
2008-10-21 12:49:29 +00:00
Cedric BAIL 1950725606 Add merge function to list data type.
SVN revision: 36922
2008-10-21 11:28:38 +00:00
Cedric BAIL 6f5b3584dd Store build information inside eina_config.h, and fix magic use.
SVN revision: 36263
2008-09-26 11:41:55 +00:00
Cedric BAIL 8b85ce70d4 Patch from quarium.
Add magic to array and list.

Need to patch autotools to generate something like eina_config.h.



SVN revision: 36256
2008-09-25 14:46:16 +00:00
Cedric BAIL e8b25fb405 Add a sort benchmark.
SVN revision: 36250
2008-09-25 12:41:49 +00:00
Vincent Torri 4313d2b084 * fix list doc
* minor other doc fixes
 * link the mempool modules statically to libeina when requested
 * don't compile static lib of mempool when they are built as shared lib


SVN revision: 36178
2008-09-23 05:17:49 +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
Vincent Torri 4485f06f66 fix a bit list documentation. Not finished yet.
SVN revision: 35702
2008-08-28 06:31:18 +00:00
Cedric BAIL 911cd4deda Add iterator/accessor to eina list.
Change list size type to unsigned int.


SVN revision: 35454
2008-08-13 09:19:34 +00:00
Cedric BAIL ce23f3c2a9 After benchmarking, providing inline does impact performance of list and array user.
SVN revision: 35406
2008-08-08 14:20:11 +00:00
Cedric BAIL f193096aa8 Add eina_list test suite. Cleanup list implementation and share out of memory error.
SVN revision: 35378
2008-08-07 13:09:09 +00:00
Cedric BAIL ddaa7d4d8f License changes (BSD -> LGPL)
SVN revision: 35360
2008-08-06 18:15:24 +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