Commit Graph

25 Commits

Author SHA1 Message Date
Jonas M. Gastal 702eb939d9 Eina: EINA_MAGIC example and documentation.
SVN revision: 60535
2011-06-20 21:15:17 +00:00
Lucas De Marchi da0c0f320f fix misuse of EINA_PURE
qsort may modify a global variable, so this function cannot have pure attribute



SVN revision: 56652
2011-02-02 17:07:49 +00:00
Mike Blumenkrantz 0c27fd1a29 ecrustify testing: looked good so I'm committing for other people to review as well
SVN revision: 53800
2010-10-23 06:41:45 +00:00
Cedric BAIL c45c36bd80 * eina: attempt to improve a little bit more the header.
Mainly trailing space and macro indentation.


SVN revision: 51217
2010-08-16 15:02:37 +00:00
Mike Blumenkrantz 44eeac0e1e BOW DOWN BEFORE ME, FOR I HAVE MADE THESE HEADERS READABLE ONCE MORE!
SVN revision: 51065
2010-08-13 06:36:33 +00:00
Carsten Haitzler ddc6ba2c2a uncrustify eina.
SVN revision: 50573
2010-07-28 02:37:05 +00:00
Sebastian Dransfeld dca87fdf87 Typo
SVN revision: 46025
2010-02-09 21:05:56 +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
Cedric BAIL 49cb141f10 * eina_magic: Test suite now work when magic debug is disabled.
SVN revision: 42150
2009-09-01 12:17:13 +00:00
Vincent Torri 7a3b2110bf * more doc
* check the returned value of eina_error_init() in eina_module_init()


SVN revision: 41218
2009-06-28 06:29:11 +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
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 199f900908 Application and library using Eina Magic API should be able to decide if they
want to check magic or not. This should not be forced by Eina config.


SVN revision: 38014
2008-12-08 10:18:05 +00:00
Gustavo Sverzut Barbieri 5939d76d9c Fix couple of issues with MAGIC handling.
eina_magic.h MUST include eina_config.h, otherwise it will not
consider EINA_MAGIC stuff. Worse than that, some files were including
that directly and were considering EINA_MAGIC attribute even if the
file that alloc'ed the memory were not!

Also add missing EINA_MAGIC_SET() to iterators and accessors.



SVN revision: 37960
2008-12-06 06:17:11 +00:00
Gustavo Sverzut Barbieri a00eaac6a6 Make it possible to create iterators outside Eina.
Many places in EFL we just create walk something, create a list with
walked data, return, then the user walks it again and then deletes
(which will walk again). For such cases it's way better to define
iterators or accessors.

I'm not moving any EFL code to it now, but if people are interested,
things like evas_render_method_list(), evas_font_available_list(),
evas_objects_at_xy_get(), evas_objects_in_rectangle_get(),
evas_object_smart_members_get() are good candidates. If the subject is
already using Eina list, then you can just use
eina_list_iterator_new() and return it, otherwise you can define your
own iterator, which is very easy.



SVN revision: 37956
2008-12-06 03:41:03 +00:00
Cedric BAIL a61ba1c35a Fix some warning.
SVN revision: 36563
2008-10-10 09:33:40 +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 040e5573d9 Patch from Arnaud de Turckheim "quarium" <quarium@gmail.com>.
Use magic inside stringshare without slowdown of benchmark.
Fix magic when not in DEBUG mode.



SVN revision: 36246
2008-09-25 09:02:41 +00:00
Cedric BAIL ddaa7d4d8f License changes (BSD -> LGPL)
SVN revision: 35360
2008-08-06 18:15:24 +00:00
Cedric BAIL bf68fa183c Fix macro.
SVN revision: 35299
2008-08-01 14:25:20 +00:00
Cedric BAIL 9321fbbfdc Fix a typo.
SVN revision: 35276
2008-07-31 16:58:22 +00:00
Cedric BAIL e04f59c7b0 Export a magic API.
SVN revision: 35270
2008-07-31 15:08:19 +00:00