Commit Graph

45 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
Carsten Haitzler ddc6ba2c2a uncrustify eina.
SVN revision: 50573
2010-07-28 02:37:05 +00:00
Vincent Torri 84efd3507f leak--, thanks cedric
SVN revision: 50225
2010-07-13 16:43:15 +00:00
Vincent Torri c97a897584 use Win32 native mutex on Windows. To use it, pass the following option
to configure:

--enable-win32-threads

By default, pthreads are used


SVN revision: 50220
2010-07-13 13:51:00 +00:00
Vincent Torri 440fb47e30 fix pthread support with mingw
SVN revision: 49250
2010-05-28 18:57:19 +00:00
Vincent Torri 0cc286508a indentation and comments
SVN revision: 48522
2010-05-01 20:35:16 +00:00
Vincent Torri 2c91c3cf21 add colored log on Windows with the DOS console and MSYS
without rxvt emulation. It does not work with MSYS with
rxvt emulation. I don't know the status of the cygwin
terminal.


SVN revision: 47486
2010-03-26 08:08:52 +00:00
Vincent Torri 8126debb06 fix most compilation errors with vc++ (there are still a
problem with eina_log and output of the log messages:
STDERR_FILENO, STDOUT_FILENO and isatty())

fix some warnings and header files inclusion

update vcproj files


SVN revision: 47384
2010-03-23 06:41:17 +00:00
Gustavo Sverzut Barbieri 90c5c1daaa doc improvements.
SVN revision: 46670
2010-02-28 21:29:30 +00:00
Gustavo Sverzut Barbieri ff6532a1bd minor documentation fixes.
still needs someone to read and review that.


SVN revision: 46499
2010-02-26 00:57:20 +00:00
Gustavo Sverzut Barbieri 728f10a269 delete trailing whitespace.
SVN revision: 46001
2010-02-09 02:51:23 +00:00
Gustavo Sverzut Barbieri 7e043d87c8 apply global log level if global domain exists.
This allows setting global log level after eina_init() and have it to
behave properly.



SVN revision: 45999
2010-02-09 02:14:40 +00:00
Gustavo Sverzut Barbieri ebed1f20fe minor matching speedups.
keep log level name size (namelen) and use it before strcmp().



SVN revision: 45998
2010-02-09 02:13:55 +00:00
Gustavo Sverzut Barbieri 0b2b716214 just try fnmatch (glob) if no specific level was set.
SVN revision: 45997
2010-02-09 01:47:52 +00:00
Gustavo Sverzut Barbieri 191d87d78a eina log level utilities.
couple of functions that are useful outside and should be fast.



SVN revision: 45996
2010-02-09 01:43:58 +00:00
Gustavo Sverzut Barbieri f7cd9786f1 eina log parameters getters and setters.
allow external users to check or set flags that are initialized based
on environment variables such as EINA_LOG_COLOR_DISABLE.



SVN revision: 45995
2010-02-09 00:52:00 +00:00
Gustavo Sverzut Barbieri c87dbf93ab disable color based on $TERM and isatty().
Smarter eina log that disables color automatically based on $TERM and
isatty of output file descriptor.



SVN revision: 45988
2010-02-08 17:53:22 +00:00
Vincent Torri 6ac6ee026c * fix compilation when iconv.h is detected but libiconv is not
* fix warning and clang report


SVN revision: 45970
2010-02-07 20:46:39 +00:00
Vincent Torri 4da59fea04 fix header inclusion
SVN revision: 45655
2010-01-28 10:03:31 +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
Vincent Torri 8c14ca031e minor fixes
SVN revision: 44720
2009-12-25 16:22:13 +00:00
Vincent Torri 0fda2ab7c8 use new spinlock detection
SVN revision: 44718
2009-12-25 11:30:41 +00:00
Cedric BAIL 899b488741 * eina: Now it's possible set a level when eina should abort on log.
SVN revision: 43669
2009-11-13 17:52:43 +00:00
Sebastian Dransfeld a60aeb07a3 function defined as void, don't return a value
SVN revision: 43535
2009-11-08 19:52:31 +00:00
Jonathan Atton cbe78d32f2 Eina log : check main thread in eina_log_threads_shutdown
SVN revision: 43415
2009-11-02 10:08:57 +00:00
Jonathan Atton 4bfc091f41 Eina : add a prefix to STRINGSHARE_LOCK and LOG_LOCK
SVN revision: 43399
2009-11-01 20:09:26 +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
Christopher Michael af793b05d5 Patch to allow a quieter eina when using eina_log in your own libs/apps.
Approved by k-s.

Added some doxy to describe the new env variable. 
(Eina authors may want to reword this...up to you)



SVN revision: 43326
2009-10-28 12:48:04 +00:00
Cedric BAIL 8e6a393cf9 * eina_log: Fallback to mutex when spinlock doesn't exist.
SVN revision: 42489
2009-09-14 16:06:18 +00:00
dieb 073dd0542c Fix segv reported by Peter Wehrfritz on eina init/shutdown (specifically on
eina_log init/shutdown as it wasn't resetting domains counters properly).


SVN revision: 42334
2009-09-07 23:23:03 +00:00
Gustavo Sverzut Barbieri f98bf21da7 allocate more buckets on init to save couple of reallocs during startup.
SVN revision: 42303
2009-09-06 22:34:38 +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
Vincent Torri 718873e00c shut down safety checks in the log module
Note : currently, because of a circular calls of
eina_log_init() and eina_safety_checks_init(), eina
is not correctly shut down. Imho, eina_log should not
depend on the safety checks module. That would mean
some fprintf in eina_log_domain_new(), eina_log_domain_free(),
eina_log_domain_register()and eina_log_domain_unregister().


SVN revision: 42292
2009-09-06 15:25:35 +00:00
Gustavo Sverzut Barbieri 5846195caf eina_log: be able to disable function or line.
write down specialized cases for threads or not, function or file,
color or not. Maybe it's not even an optimization since we add yet
another indirection/function call, but each case is simpler.

 * EINA_LOG_FILE_DISABLE=1: disables show of file:line in
   stderr/stdout messages.
 * EINA_LOG_FUNCTION_DISABLE=1: disables show of function() in
   stderr/stdout messages.

one must not use the two options at the same time, if that's the case
code will ignore EINA_LOG_FILE_DISABLE=1 and use just function
disable.



SVN revision: 42272
2009-09-04 23:45:16 +00:00
Gustavo Sverzut Barbieri dfee09d6b0 make it easier to spot wrong users of eina_log_print()
SVN revision: 42226
2009-09-04 02:34:10 +00:00
Gustavo Sverzut Barbieri eeb2d38d38 eina_log_vprint() for those that want to wrap it in other functions.
SVN revision: 42216
2009-09-04 00:57:09 +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
Gustavo Sverzut Barbieri cee03dcb3c eina_log: CONVENTION BREAK!!!! automatically adds \n
Automatically add \n to messages. Since we use that prefix, there is
no use to allow messages without \n, it would look a mess.

Some logging systems may not require the trailing newline, for example
logging to xml or syslog, for those you don't need to ignore this char
if present.

Yes, this breaks convention, but better now than latter. And the
results are not so bad.



SVN revision: 42200
2009-09-03 01:39:45 +00:00
Gustavo Sverzut Barbieri 8024360138 eina_log: thread safe logging!
eina_log_threads_enable() and then get thread safe logging with
non-main threads being printed with special notation to easily spot
those.



SVN revision: 42199
2009-09-03 01:31:26 +00:00
Gustavo Sverzut Barbieri d8ee1b3a24 eina_log: fix error handling and handle deleted domains.
EINA_SAFETY_CHECKS will call eina_log, so calling these from inside
eina_log_print() may lead to recursion, that is really bad (although
it seems it would never lead to infinite recursion).

handle d->deleted, also showing error.



SVN revision: 42198
2009-09-03 00:17:27 +00:00
Gustavo Sverzut Barbieri 9fb9b1259d eina_log: fix stderr, improve log output.
* stderr logger was doing prefix properly but user message to stdout, fixed.
 * log is improved:
   * grep-able, it shows the 3 letter level name as prefix, unknown levels
     will have their number printed.
   * colors just on prefix, less polluted output still easy to spot.
   * function names are highlighted.



SVN revision: 42197
2009-09-03 00:07:25 +00:00
Gustavo Sverzut Barbieri 418c99a8e3 eina_log improvements: docs, micro optimizations and stderr logging by default.
* more docs.
 * do not getenv("EINA_LOG_ABORT") everytime, just at init.
 * EINA_UNLIKELY() in some critical paths (not that big impact anyway)
 * eina_log_print_cb_stderr() and use it by default.




SVN revision: 42196
2009-09-02 23:28:00 +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
Vincent Torri 5612cf9020 * declare variables at the beginning of the block
* strtol returns a long int

SVN revision: 42063
2009-08-28 07:21:35 +00:00
dieb d7bbc05b12 Initial import of the new eina logging API.
* eina_error might be kept for error messages and codes, but it's logging API
  will be deprecated. For now, it's been kept for not breaking others code and
  for a smoother transition.
* Added test for new logging API, also demonstrates usage.


SVN revision: 41960
2009-08-24 21:43:48 +00:00