Commit Graph

90 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
Christopher Michael b82186120a Fix 'unused variable'.
SVN revision: 51290
2010-08-18 16:26:20 +00:00
Mike McCormack 3bdbb34d64 From: Mike McCormack <mj.mccormack@samsung.com>
This patch implements the ecore main loop in terms of the GTK main loop, so
ecore is a layer on top of glib.

Compared the the current glib integration in ecore, this has the added
advantage of allowing use of EFL libraries in GTK.



SVN revision: 51113
2010-08-14 11:19:03 +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
Mike Blumenkrantz a475971aaa convert all function pointers to typedefs, add doxy stubs for typedefs.
note: I've chosen to consolidate typedefs where possible to simplify things

my time is limited this week, so feel free to expand on the doxy stubs I've added if you know what they do


SVN revision: 50803
2010-08-04 02:55:20 +00:00
Lucas De Marchi 8989ca1261 Spell: rememebr => remember
SVN revision: 50686
2010-07-30 11:34:08 +00:00
Carsten Haitzler ffc048d5e4 doc++
SVN revision: 50673
2010-07-30 02:57:39 +00:00
Carsten Haitzler 24bf638323 clean up epoll stuff a little bit. 32 events now.
SVN revision: 50668
2010-07-30 02:42:47 +00:00
Carsten Haitzler 29e957d6a7 bad mike!. fix.
SVN revision: 50634
2010-07-29 05:43:20 +00:00
Carsten Haitzler 93d98ebedf epoll <- blame mike if it breaks. :)
SVN revision: 50585
2010-07-28 06:08:35 +00:00
Cedric BAIL fbe9064310 * ecore: Ecore callback really should return Eina_Bool.
SVN revision: 49829
2010-06-24 16:15:56 +00:00
Carsten Haitzler 9b50145007 formatting cleanups.
SVN revision: 48970
2010-05-18 08:01:06 +00:00
Vincent Torri 141a2bb9a8 fix the Windows select function:
* On Windows, the values returned by pipe() are sockets.
   Hence they can be huge. Iterate over the list of "fds"
   instead of the max value
 * In the loop which iterates over the win32 handlers,
   we never go to the next element, so infinite loop...


SVN revision: 48807
2010-05-13 08:10:17 +00:00
Carsten Haitzler 0dc8a3d0b7 \n--
SVN revision: 48371
2010-04-28 00:05:56 +00:00
Carsten Haitzler 9941fd4f8e better debug/error output for foreign fd issues.
SVN revision: 48370
2010-04-27 23:53:08 +00:00
Carsten Haitzler a08e3d18dc formatting.
SVN revision: 48354
2010-04-27 04:30:55 +00:00
Vincent Torri 898768c963 various fixes for vc++. I'll add the Visual Studio projects later
SVN revision: 47758
2010-04-05 08:26:48 +00:00
Gustavo Sverzut Barbieri e54bd066ec Convert everything to EINA_(TRUE|FALSE)
make it consistent.

By: Lucas de Marchi.



SVN revision: 46539
2010-02-27 00:01:10 +00:00
Gustavo Sverzut Barbieri 2d60db1c2b Fix fd_handlers when using recursive main loops.
If an fd_handler created a recursive main loop (just called
ecore_main_loop_begin()), then this recursive main loop should
continue to process fd_handlers from there and on, thus
fd_handler_current (and win32_handler_current) was added. When going
back from recursion, the current iterator should be updated properly.

This patch also fixes the deletion of fd_handler from recursive main
loops by reference counting them. This way, the node will not be
free()d inside inner loop cleanups and then crash when going back to
outer loop.

PS: win32 code is untested (or even compiled).

The following test case used to crash but not anymore:

#include <Ecore.h>
#include <Eina.h>
#include <unistd.h>

static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(_log_dom, __VA_ARGS__)

static Ecore_Fd_Handler *handle;
static int a[2], b[2];

static int cb2(void *data, Ecore_Fd_Handler *h)
{
    INF("cb2 - delete cb1 handle");
    ecore_main_fd_handler_del(handle);
    ecore_main_loop_quit(); /* quits inner main loop */
    return 0;
}

static int cb1(void *data, Ecore_Fd_Handler *h)
{
    unsigned char ch = 222;

    INF("cb1: begin");
    INF("    add cb2");
    ecore_main_fd_handler_add(b[0], ECORE_FD_READ, cb2, NULL, NULL, NULL);
    INF("    wake up pipe b");
    if (write(b[1], &ch, 1) != 1)
        ERR("could not write to pipe b");
    INF("    inner main loop begin (recurse)");
    ecore_main_loop_begin(); /* will it crash due
                              * ecore_main_fd_handler_del(handle)
                              * inside cb2()? It used to!
                              */
    INF("cb1: end");

    ecore_main_loop_quit(); /* quits outer main loop */

    return 0;
}

int main(void)
{
    unsigned char ch = 111;

    ecore_init();

    _log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
    pipe(a);
    pipe(b);

    /*
     * Creating a new main loop from inside an fd_handler callback,
     * and inside this new (inner) main loop deleting the caller
     * callback used to crash since the handle would be effectively
     * free()d, but when the recursion is over the pointer would be
     * used.
     */

    INF("main: begin");
    handle = ecore_main_fd_handler_add
        (a[0], ECORE_FD_READ, cb1, NULL, NULL, NULL);
    INF("main: wake up pipe a");
    if (write(a[1], &ch, 1) != 1)
        ERR("could not write to pipe a");
    ecore_main_loop_begin();
    INF("main: end");
    return 0;
}



SVN revision: 46443
2010-02-24 20:59:44 +00:00
Gustavo Sverzut Barbieri 18b1bf46d7 move bitfield booleans to Eina_Bool.
using one bit with integers will just have room for 0 and -1, not 0 and 1.



SVN revision: 46412
2010-02-23 22:49:15 +00:00
Gustavo Sverzut Barbieri dbc4a40265 Fix the bug of the first timer being added from idler.
We should start doing unit-test for ecore, accumulating these
problems. Follows the test case:

#include <Ecore.h>
#include <Eina.h>

static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)

static int quiter(void *data)
{
    INF("quit!");
    ecore_main_loop_quit();
    return 1;
}

static int idler(void *data)
{
    INF("idler");
    return 1;
}

static int cb1(void *data)
{
    INF("cb1");
    ecore_timer_add(0.0, quiter, NULL);

    return 0;
}

int main(void)
{
    ecore_init();

    _log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);

    /*
     * Create a main loop with just idlers, there is a special case
     * for just idlers without timers in ecore.
     *
     * From idler, add a timer that quits the application. It should
     * always quit.
     *
     * If it does not quit, then there is a bug of new timers not
     * being immediately detected and system never exits idle.
     */

    INF("main: begin");
    ecore_idler_add(cb1, NULL);
    ecore_idler_add(idler, NULL);
    ecore_main_loop_begin();
    INF("main: end");
    return 0;
}




SVN revision: 46405
2010-02-23 21:04:38 +00:00
Carsten Haitzler e70759878c rfiddling wiht lop to try and get rid of pauses. i think i found it... plus a
bit of streamlining. need to test more widely now.



SVN revision: 46303
2010-02-19 08:00:44 +00:00
Vincent Torri d1bdb785b1 fix warnings on opensolaris
SVN revision: 45219
2010-01-16 13:44:25 +00:00
Vincent Torri a4b0afb1e4 * move structures from ecore_private.h to the corresponding source files
* add 2 internal ecore_exe functions as ecore_signak.c uses Ecore_Exe members
   no test is done in those 2 functions
 * remove standard headers from ecore_private.h



SVN revision: 44862
2010-01-03 21:55:50 +00:00
Sebastian Dransfeld 0a9456ccf7 Remove duplication from ecore headers
Clean up Ecore.h and ecore_private.h

SVN revision: 44664
2009-12-22 21:15:12 +00:00
Cedric BAIL d8e1895350 * ecore: Use eina_log.
Patch from Mathieu Taillefumier.


SVN revision: 44637
2009-12-21 17:32:19 +00:00
Cedric BAIL 42f896caf2 * ecore: Don't select on deleted fd handler.
SVN revision: 44627
2009-12-21 13:27:58 +00:00
Sebastian Dransfeld 73cde2ffa2 Make clang happy
SVN revision: 44257
2009-12-07 21:01:26 +00:00
Vincent Torri ed3ac88827 Add data and error events in ecore_exe_win32.c.
There are still some problems with the win32 select loop, though

SVN revision: 44229
2009-12-06 19:25:48 +00:00
Vincent Torri f4e1c3a9b9 * add a _del function for win32 HANDLEs
* delete HANDLES when asked
 * minor fixes in the win32 code

SVN revision: 43939
2009-11-23 23:09:48 +00:00
Gustavo Sverzut Barbieri 85111dfe87 do not run cleanup all the time and avoid bug of walking list from
inside list.

if l->next was also deleted by _ecore_main_fd_handlers_cleanup(), then
we had a crash :-(




SVN revision: 43676
2009-11-13 20:34:51 +00:00
Vincent Torri a6713c7af1 Fixes for the Win32 port:
* if ecore_events are in the queue, timeout 0 is passed and
   MsgWaitForMultipleObjects returns immediately, which can
   lead to problems. If timeout is 0, we do nothing (that is,
   we wait for the ecore_events to finish first)
 * manage the case when MsgWaitForMultipleObjects returns WAIT_FAILED

SVN revision: 43547
2009-11-08 22:14:48 +00:00
Vincent Torri f5fec31eb9 wait on HANDLES in the select loop on Windows.
SVN revision: 43253
2009-10-25 07:07:48 +00:00
Vincent Torri 64d7bf0c71 events is an array of HANDLE's, not an array of pointers of HANDLE's
SVN revision: 43162
2009-10-20 10:46:05 +00:00
Vincent Torri 654330e183 warnings--
SVN revision: 42018
2009-08-26 15:43:45 +00:00
Gustavo Sverzut Barbieri 6103d8db01 oops, fix case of timers never being fired while we have idlers.
To reach this case, have a timer that would not be fired on
_ecore_main_loop_iterate_internal(), for example it's not ready yet
(just_added==1), system would get into this inner loop and would never
stop, since there is timer expired now (next_time == 0.0), if we go to
start_loop it would just get into the same loop, not dispatching and
timers.

Python test 04-idler.py triggered that problem.




SVN revision: 41342
2009-07-15 00:11:04 +00:00
Vincent Torri 88e6e10da1 Rework the Windows message loop and the managing of sockets
sent by ecore_pipe. The programs based on Ecore on Windows
do not take 100% of the cpu power anymore.

Patch by Lars Munch, modified by me (formatting + guards)


SVN revision: 41179
2009-06-24 06:14:07 +00:00
Gustavo Sverzut Barbieri 369a502a28 fix nasty bug of timers not being re-evaluated on rare case.
If there are no other main loop activity than a idlers and one idler
adds a timer, the new (and unique) timer would be ignored since it's
flagged as "just_added" and thus next iteration will not consider it,
possible entering an infinite wait as it could be the only thing to do
in main loop.

Antognolli found this nasty bug while handling timeout-and-die in
Ethumb, where the "disconnect" event is dispatched by EDBus from idler
and it was adding a timer to shutdown the daemon after a while without
clients.

By: Rafael Antognolli <antognolli@profusion.mobi>



SVN revision: 40923
2009-06-06 22:31:34 +00:00
Christopher Michael a807d836e6 Remove annoying printf messages when downloading something via ecore.
SVN revision: 40175
2009-04-18 17:16:03 +00:00
Gustavo Sverzut Barbieri 852c598be4 Be able to change select() function used by main loop.
Patch by Kenneth Christiansen, used to integrate with GLib and other
main loops.



SVN revision: 40110
2009-04-16 15:44:26 +00:00
Vincent Torri 99b44984bd fix compilation on Windows
SVN revision: 39984
2009-04-11 13:46:09 +00:00
Carsten Haitzler aa740325f6 andre dieb: patch to fix ebadf handling.
SVN revision: 39932
2009-04-10 12:48:25 +00:00
Gustavo Sverzut Barbieri 56516f66e2 remove more debug code left by cedric.
SVN revision: 39913
2009-04-09 21:31:29 +00:00
Cedric BAIL 140a357fe6 * ecore: Remove debug code.
SVN revision: 39364
2009-03-04 12:40:50 +00:00
Cedric BAIL 775ecc6a05 * Move Ecore_Fd_Handler to Eina_Inlist.
SVN revision: 39360
2009-03-04 10:50:14 +00:00
Vincent Torri 79b536dce8 initialize next_time to -1.0 by default.
this fix a problem on Windows: the ecore main loop
hanged because of GetMessage() if next_time had a
random value.

patch by Lars Munch



SVN revision: 39178
2009-02-24 17:26:26 +00:00
Carsten Haitzler a56a138a2c eek. loop time is wrong when using idlers heavily... leads to jerkybobos. fix!
SVN revision: 39087
2009-02-19 06:02:35 +00:00
Vincent Torri e18508b701 remove a bit the mess n ecore. It's just the first patch...
* add vim header
 * include config.h when necessary
 * fix the order of some include
 * move the standard header in ecore_private.h to the source files

I have recompiled all the efl and e17, and e17 seems to work fine with these changes.
If you encounter problems with that commit, let me know.


SVN revision: 38864
2009-01-31 18:33:39 +00:00
Vincent Torri b1f46fb7e8 remove trailing spaces
SVN revision: 37851
2008-11-29 11:23:17 +00:00
Vincent Torri e3dd190240 remove the problem of the main loop taking 100% of the cpu
consumption on Windows


SVN revision: 37699
2008-11-18 06:56:31 +00:00