From: <enl...@li...> - 2003-01-23 23:03:55
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore Modified Files: Tag: SPLIT ecore_events.c ecore_exe.c ecore_idle_enterer.c ecore_idler.c ecore_main.c ecore_private.h ecore_timer.c Log Message: cleanup warnings simplify event freeing for x module (less code, less worries) optimise some of the event loop to only loop thru handlers, idlers, etc. for deletion if the delete flag is set. not sure i can optimise this much more, and even so i'm not sure anyone would ever notice if i could... =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_events.c,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -3 -r1.1.2.2 -r1.1.2.3 --- ecore_events.c 16 Jan 2003 10:30:30 -0000 1.1.2.2 +++ ecore_events.c 23 Jan 2003 23:03:23 -0000 1.1.2.3 @@ -1,12 +1,13 @@ #include "ecore_private.h" #include "Ecore.h" -static int events_num = 0; -static Ecore_Event *events = NULL; +static int events_num = 0; +static Ecore_Event *events = NULL; static Ecore_Event_Handler *event_handlers = NULL; +static int event_handlers_delete_me = 0; -static int event_id_max = ECORE_EVENT_COUNT; +static int event_id_max = ECORE_EVENT_COUNT; /** * Add an event handler @@ -45,6 +46,7 @@ { if (!event_handler) return NULL; event_handler->delete_me = 1; + event_handlers_delete_me = 1; return event_handler->data; } @@ -77,7 +79,7 @@ void * ecore_event_del(Ecore_Event *event) { - if (!event) return; + if (!event) return NULL; event->delete_me = 1; return event->data; } @@ -136,19 +138,19 @@ { Ecore_List *l; - for (l = events; l; l = l->next) + for (l = (Ecore_List *)events; l; l = l->next) { Ecore_List *ll; Ecore_Event *e; - e = l; + e = (Ecore_Event *)l; if (!e->delete_me) { - for (ll = event_handlers; ll; ll = ll->next) + for (ll = (Ecore_List *)event_handlers; ll; ll = ll->next) { Ecore_Event_Handler *eh; - eh = ll; + eh = (Ecore_Event_Handler *)ll; if (!eh->delete_me) { if (eh->type == e->type) @@ -161,11 +163,12 @@ } } while (events) _ecore_event_del(events); - for (l = event_handlers; l;) + if (!event_handlers_delete_me) return; + for (l = (Ecore_List *)event_handlers; l;) { Ecore_Event_Handler *eh; - eh = l; + eh = (Ecore_Event_Handler *)l; l = l->next; if (eh->delete_me) { @@ -173,6 +176,7 @@ free(eh); } } + event_handlers_delete_me = 0; } void * =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_exe.c,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -3 -r1.1.2.2 -r1.1.2.3 --- ecore_exe.c 16 Jan 2003 10:30:30 -0000 1.1.2.2 +++ ecore_exe.c 23 Jan 2003 23:03:23 -0000 1.1.2.3 @@ -180,11 +180,11 @@ { Ecore_List *l; - for (l = exes; l; l = l->next) + for (l = (Ecore_List *)exes; l; l = l->next) { Ecore_Exe *exe; - exe = l; + exe = (Ecore_Exe *)l; if (exe->pid == pid) return exe; } return NULL; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_idle_enterer.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -3 -r1.1.2.1 -r1.1.2.2 --- ecore_idle_enterer.c 16 Jan 2003 08:48:51 -0000 1.1.2.1 +++ ecore_idle_enterer.c 23 Jan 2003 23:03:23 -0000 1.1.2.2 @@ -2,6 +2,7 @@ #include "Ecore.h" static Ecore_Idle_Enterer *idle_enterers = NULL; +static int idle_enterers_delete_me = 0; /** * Add an idle enterer handler @@ -37,6 +38,7 @@ { if (!idle_enterer) return NULL; idle_enterer->delete_me = 1; + idle_enterers_delete_me = 1; return idle_enterer->data; } @@ -45,27 +47,31 @@ { Ecore_List *l; - for (l = idle_enterers; l; l = l->next) + for (l = (Ecore_List *)idle_enterers; l; l = l->next) { Ecore_Idle_Enterer *ie; - ie = l; + ie = (Ecore_Idle_Enterer *)l; if (!ie->delete_me) { if (!ie->func(ie->data)) ecore_idle_enterer_del(ie); } } - for (l = idle_enterers; l;) + if (idle_enterers_delete_me) { - Ecore_Idle_Enterer *ie; - - ie = l; - l = l->next; - if (ie->delete_me) + for (l = (Ecore_List *)idle_enterers; l;) { - idle_enterers = _ecore_list_remove(idle_enterers, ie); - free(ie); + Ecore_Idle_Enterer *ie; + + ie = (Ecore_Idle_Enterer *)l; + l = l->next; + if (ie->delete_me) + { + idle_enterers = _ecore_list_remove(idle_enterers, ie); + free(ie); + } } + idle_enterers_delete_me = 0; } } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_idler.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -3 -r1.1.2.1 -r1.1.2.2 --- ecore_idler.c 16 Jan 2003 08:48:51 -0000 1.1.2.1 +++ ecore_idler.c 23 Jan 2003 23:03:23 -0000 1.1.2.2 @@ -2,6 +2,7 @@ #include "Ecore.h" static Ecore_Idle_Enterer *idlers = NULL; +static int idlers_delete_me = 0; /** * Add an idle handler @@ -37,6 +38,7 @@ { if (!idler) return NULL; idler->delete_me = 1; + idlers_delete_me = 1; return idler->data; } @@ -45,27 +47,31 @@ { Ecore_List *l; - for (l = idlers; l; l = l->next) + for (l = (Ecore_List *)idlers; l; l = l->next) { Ecore_Idler *ie; - ie = l; + ie = (Ecore_Idler *)l; if (!ie->delete_me) { if (!ie->func(ie->data)) ecore_idler_del(ie); } } - for (l = idlers; l;) + if (idlers_delete_me) { - Ecore_Idler *ie; - - ie = l; - l = l->next; - if (ie->delete_me) + for (l = (Ecore_List *)idlers; l;) { - idlers = _ecore_list_remove(idlers, ie); - free(ie); + Ecore_Idler *ie; + + ie = (Ecore_Idler *)l; + l = l->next; + if (ie->delete_me) + { + idlers = _ecore_list_remove(idlers, ie); + free(ie); + } } + idlers_delete_me = 0; } if (idlers) return 1; return 0; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_main.c,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -3 -r1.1.2.2 -r1.1.2.3 --- ecore_main.c 16 Jan 2003 12:09:26 -0000 1.1.2.2 +++ ecore_main.c 23 Jan 2003 23:03:24 -0000 1.1.2.3 @@ -13,6 +13,7 @@ static int quit = 0; static Ecore_Fd_Handler *fd_handlers = NULL; +static int fd_handlers_delete_me = 0; /** * Run the application main loop @@ -202,6 +203,7 @@ { if (!fd_handler) return NULL; fd_handler->delete_me = 1; + fd_handlers_delete_me = 1; return fd_handler->data; } @@ -268,11 +270,11 @@ max_fd = 0; FD_ZERO(&rfds); FD_ZERO(&wfds); - for (l = fd_handlers; l; l = l->next) + for (l = (Ecore_List *)fd_handlers; l; l = l->next) { Ecore_Fd_Handler *fdh; - fdh = l; + fdh = (Ecore_Fd_Handler *)l; if (fdh->flags & ECORE_FD_READ) { FD_SET(fdh->fd, &rfds); @@ -292,11 +294,11 @@ } if (ret > 0) { - for (l = fd_handlers; l; l = l->next) + for (l = (Ecore_List *)fd_handlers; l; l = l->next) { Ecore_Fd_Handler *fdh; - fdh = l; + fdh = (Ecore_Fd_Handler *)l; if (!fdh->delete_me) { if (FD_ISSET(fdh->fd, &rfds)) @@ -316,11 +318,12 @@ { Ecore_List *l; - for (l = fd_handlers; l;) + if (!fd_handlers_delete_me) return; + for (l = (Ecore_List *)fd_handlers; l;) { Ecore_Fd_Handler *fdh; - fdh = l; + fdh = (Ecore_Fd_Handler *)l; l = l->next; if (fdh->delete_me) { @@ -328,6 +331,7 @@ free(fdh); } } + fd_handlers_delete_me = 0; } static void @@ -335,17 +339,20 @@ { Ecore_List *l; - for (l = fd_handlers; l; l = l->next) + for (l = (Ecore_List *)fd_handlers; l; l = l->next) { Ecore_Fd_Handler *fdh; - fdh = l; + fdh = (Ecore_Fd_Handler *)l; if (!fdh->delete_me) { if ((fdh->read_active) || (fdh->write_active)) { if (!fdh->func(fdh, fdh->data)) - fdh->delete_me = 1; + { + fdh->delete_me = 1; + fd_handlers_delete_me = 1; + } fdh->read_active = 0; fdh->write_active = 0; } @@ -360,11 +367,11 @@ int ret; ret = 0; - for (l = fd_handlers; l; l = l->next) + for (l = (Ecore_List *)fd_handlers; l; l = l->next) { Ecore_Fd_Handler *fdh; - fdh = l; + fdh = (Ecore_Fd_Handler *)l; if (!fdh->delete_me) { if (fdh->buf_func) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_private.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -3 -r1.1.2.2 -r1.1.2.3 --- ecore_private.h 16 Jan 2003 10:30:30 -0000 1.1.2.2 +++ ecore_private.h 23 Jan 2003 23:03:24 -0000 1.1.2.3 @@ -92,7 +92,7 @@ int type; void *event; int delete_me : 1; - void (*func_free) (Ecore_Event *ev, void *data); + void (*func_free) (void *ev, void *data); void *data; }; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Attic/ecore_timer.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -3 -r1.1.2.1 -r1.1.2.2 --- ecore_timer.c 16 Jan 2003 08:48:51 -0000 1.1.2.1 +++ ecore_timer.c 23 Jan 2003 23:03:24 -0000 1.1.2.2 @@ -96,7 +96,7 @@ { Ecore_Timer *t2; - t2 = l; + t2 = (Ecore_Timer *)l; if (timer->at > t2->at) { timers = _ecore_list_append_relative(timers, timer, t2); |