aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore/ecore_events.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_events.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/libraries/ecore/src/lib/ecore/ecore_events.c b/libraries/ecore/src/lib/ecore/ecore_events.c
index f31baf8..0550224 100644
--- a/libraries/ecore/src/lib/ecore/ecore_events.c
+++ b/libraries/ecore/src/lib/ecore/ecore_events.c
@@ -19,6 +19,7 @@ struct _Ecore_Event_Handler
19 int references; 19 int references;
20 Eina_Bool delete_me : 1; 20 Eina_Bool delete_me : 1;
21}; 21};
22GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event_Handler);
22 23
23struct _Ecore_Event_Filter 24struct _Ecore_Event_Filter
24{ 25{
@@ -32,6 +33,7 @@ struct _Ecore_Event_Filter
32 int references; 33 int references;
33 Eina_Bool delete_me : 1; 34 Eina_Bool delete_me : 1;
34}; 35};
36GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event_Filter);
35 37
36struct _Ecore_Event 38struct _Ecore_Event
37{ 39{
@@ -44,6 +46,7 @@ struct _Ecore_Event
44 int references; 46 int references;
45 Eina_Bool delete_me : 1; 47 Eina_Bool delete_me : 1;
46}; 48};
49GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event);
47 50
48static int events_num = 0; 51static int events_num = 0;
49static Ecore_Event *events = NULL; 52static Ecore_Event *events = NULL;
@@ -109,7 +112,7 @@ ecore_event_handler_add(int type,
109 112
110 if (!func) goto unlock; 113 if (!func) goto unlock;
111 if ((type <= ECORE_EVENT_NONE) || (type >= event_id_max)) goto unlock; 114 if ((type <= ECORE_EVENT_NONE) || (type >= event_id_max)) goto unlock;
112 eh = calloc(1, sizeof(Ecore_Event_Handler)); 115 eh = ecore_event_handler_calloc(1);
113 if (!eh) goto unlock; 116 if (!eh) goto unlock;
114 ECORE_MAGIC_SET(eh, ECORE_MAGIC_EVENT_HANDLER); 117 ECORE_MAGIC_SET(eh, ECORE_MAGIC_EVENT_HANDLER);
115 eh->type = type; 118 eh->type = type;
@@ -130,7 +133,7 @@ ecore_event_handler_add(int type,
130 new_handlers = realloc(event_handlers, event_handlers_alloc_num * sizeof(Ecore_Event_Handler *)); 133 new_handlers = realloc(event_handlers, event_handlers_alloc_num * sizeof(Ecore_Event_Handler *));
131 if (!new_handlers) 134 if (!new_handlers)
132 { 135 {
133 free(eh); 136 ecore_event_handler_mp_free(eh);
134 goto unlock; 137 goto unlock;
135 } 138 }
136 event_handlers = new_handlers; 139 event_handlers = new_handlers;
@@ -234,7 +237,7 @@ unlock:
234static void 237static void
235_ecore_event_generic_free(void *data __UNUSED__, 238_ecore_event_generic_free(void *data __UNUSED__,
236 void *event) 239 void *event)
237{ 240{ /* DO NOT MEMPOOL FREE THIS */
238 free (event); 241 free (event);
239} 242}
240 243
@@ -358,7 +361,7 @@ ecore_event_filter_add(Ecore_Data_Cb func_start,
358 361
359 _ecore_lock(); 362 _ecore_lock();
360 if (!func_filter) goto unlock; 363 if (!func_filter) goto unlock;
361 ef = calloc(1, sizeof(Ecore_Event_Filter)); 364 ef = ecore_event_filter_calloc(1);
362 if (!ef) goto unlock; 365 if (!ef) goto unlock;
363 ECORE_MAGIC_SET(ef, ECORE_MAGIC_EVENT_FILTER); 366 ECORE_MAGIC_SET(ef, ECORE_MAGIC_EVENT_FILTER);
364 ef->func_start = func_start; 367 ef->func_start = func_start;
@@ -469,11 +472,11 @@ _ecore_event_shutdown(void)
469 { 472 {
470 event_handlers[i] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[i]), EINA_INLIST_GET(event_handlers[i])); 473 event_handlers[i] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[i]), EINA_INLIST_GET(event_handlers[i]));
471 ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE); 474 ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
472 if (!eh->delete_me) free(eh); 475 if (!eh->delete_me) ecore_event_handler_mp_free(eh);
473 } 476 }
474 } 477 }
475 EINA_LIST_FREE(event_handlers_delete_list, eh) 478 EINA_LIST_FREE(event_handlers_delete_list, eh)
476 free(eh); 479 ecore_event_handler_mp_free(eh);
477 if (event_handlers) free(event_handlers); 480 if (event_handlers) free(event_handlers);
478 event_handlers = NULL; 481 event_handlers = NULL;
479 event_handlers_num = 0; 482 event_handlers_num = 0;
@@ -482,7 +485,7 @@ _ecore_event_shutdown(void)
482 { 485 {
483 event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(event_filters)); 486 event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(event_filters));
484 ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE); 487 ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
485 free(ef); 488 ecore_event_filter_mp_free(ef);
486 } 489 }
487 event_filters_delete_me = 0; 490 event_filters_delete_me = 0;
488 event_filter_current = NULL; 491 event_filter_current = NULL;
@@ -506,7 +509,7 @@ _ecore_event_add(int type,
506{ 509{
507 Ecore_Event *e; 510 Ecore_Event *e;
508 511
509 e = calloc(1, sizeof(Ecore_Event)); 512 e = ecore_event_calloc(1);
510 if (!e) return NULL; 513 if (!e) return NULL;
511 ECORE_MAGIC_SET(e, ECORE_MAGIC_EVENT); 514 ECORE_MAGIC_SET(e, ECORE_MAGIC_EVENT);
512 e->type = type; 515 e->type = type;
@@ -535,7 +538,7 @@ _ecore_event_del(Ecore_Event *event)
535 if (event->func_free) _ecore_call_end_cb(event->func_free, event->data, event->event); 538 if (event->func_free) _ecore_call_end_cb(event->func_free, event->data, event->event);
536 events = (Ecore_Event *)eina_inlist_remove(EINA_INLIST_GET(events), EINA_INLIST_GET(event)); 539 events = (Ecore_Event *)eina_inlist_remove(EINA_INLIST_GET(events), EINA_INLIST_GET(event));
537 ECORE_MAGIC_SET(event, ECORE_MAGIC_NONE); 540 ECORE_MAGIC_SET(event, ECORE_MAGIC_NONE);
538 free(event); 541 ecore_event_mp_free(event);
539 events_num--; 542 events_num--;
540 return data; 543 return data;
541} 544}
@@ -638,7 +641,7 @@ _ecore_event_filters_apply()
638 641
639 event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef)); 642 event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef));
640 ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE); 643 ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
641 free(ef); 644 ecore_event_filter_mp_free(ef);
642 } 645 }
643 } 646 }
644 if (!deleted_in_use) 647 if (!deleted_in_use)
@@ -742,7 +745,7 @@ _ecore_event_call(void)
742 745
743 event_handlers[eh->type] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[eh->type]), EINA_INLIST_GET(eh)); 746 event_handlers[eh->type] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[eh->type]), EINA_INLIST_GET(eh));
744 ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE); 747 ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
745 free(eh); 748 ecore_event_handler_mp_free(eh);
746 } 749 }
747} 750}
748 751