};
#define GENERIC_ALLOC_FREE(TYPE, Type) \
- Ecore_Mempool Type##_mp = { #TYPE, NULL, sizeof (TYPE) }; \
+ extern size_t _ecore_sizeof_##TYPE; \
+ Ecore_Mempool Type##_mp = { #TYPE, NULL, 0 }; \
TYPE * \
Type##_calloc(unsigned int num) \
{ \
- return eina_mempool_calloc(Type##_mp.mp, num * sizeof (TYPE)); \
+ return eina_mempool_calloc(Type##_mp.mp, \
+ num * _ecore_sizeof_##TYPE); \
} \
void \
Type##_mp_free(TYPE *e) \
const char *choice;
unsigned int i;
+#define MP_SIZE_INIT(TYPE, Type) \
+ Type##_mp.size = _ecore_sizeof_##TYPE
+
+ MP_SIZE_INIT(Ecore_Animator, ecore_animator);
+ MP_SIZE_INIT(Ecore_Event_Handler, ecore_event_handler);
+ MP_SIZE_INIT(Ecore_Event_Filter, ecore_event_filter);
+ MP_SIZE_INIT(Ecore_Event, ecore_event);
+ MP_SIZE_INIT(Ecore_Idle_Exiter, ecore_idle_exiter);
+ MP_SIZE_INIT(Ecore_Idle_Enterer, ecore_idle_enterer);
+ MP_SIZE_INIT(Ecore_Idler, ecore_idler);
+ MP_SIZE_INIT(Ecore_Job, ecore_job);
+ MP_SIZE_INIT(Ecore_Timer, ecore_timer);
+ MP_SIZE_INIT(Ecore_Poller, ecore_poller);
+ MP_SIZE_INIT(Ecore_Pipe, ecore_pipe);
+ MP_SIZE_INIT(Ecore_Fd_Handler, ecore_fd_handler);
+#ifdef _WIN32
+ MP_SIZE_INIT(Ecore_Win32_Handler, ecore_win32_handler);
+#endif
+#undef MP_SIZE_INIT
+
choice = getenv("EINA_MEMPOOL");
if ((!choice) || (!choice[0]))
choice = "chained_mempool";
#include "Ecore.h"
#include "ecore_private.h"
+struct _Ecore_Animator
+{
+ EINA_INLIST;
+ ECORE_MAGIC;
+
+ Ecore_Task_Cb func;
+ void *data;
+
+ double start, run;
+ Ecore_Timeline_Cb run_func;
+ void *run_data;
+
+ Eina_Bool delete_me : 1;
+ Eina_Bool suspended : 1;
+};
+
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Animator);
+
static Eina_Bool _ecore_animator_run(void *data);
static Eina_Bool _ecore_animator(void *data);
static int inpurge = 0;
+struct _Ecore_Event_Handler
+{
+ EINA_INLIST;
+ ECORE_MAGIC;
+ int type;
+ Ecore_Event_Handler_Cb func;
+ void *data;
+ int references;
+ Eina_Bool delete_me : 1;
+};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event_Handler);
+
+struct _Ecore_Event_Filter
+{
+ EINA_INLIST;
+ ECORE_MAGIC;
+ Ecore_Data_Cb func_start;
+ Ecore_Filter_Cb func_filter;
+ Ecore_End_Cb func_end;
+ void *loop_data;
+ void *data;
+ int references;
+ Eina_Bool delete_me : 1;
+};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event_Filter);
+
+struct _Ecore_Event
+{
+ EINA_INLIST;
+ ECORE_MAGIC;
+ int type;
+ void *event;
+ Ecore_End_Cb func_free;
+ void *data;
+ int references;
+ Eina_Bool delete_me : 1;
+};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event);
+
static int events_num = 0;
static Ecore_Event *events = NULL;
static Ecore_Event *event_current = NULL;
#include "Ecore.h"
#include "ecore_private.h"
+struct _Ecore_Idle_Enterer
+{
+ EINA_INLIST;
+ ECORE_MAGIC;
+ Ecore_Task_Cb func;
+ void *data;
+ int references;
+ Eina_Bool delete_me : 1;
+};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Idle_Enterer);
+
static Ecore_Idle_Enterer *idle_enterers = NULL;
static Ecore_Idle_Enterer *idle_enterer_current = NULL;
static int idle_enterers_delete_me = 0;
#include "Ecore.h"
#include "ecore_private.h"
+struct _Ecore_Idle_Exiter
+{
+ EINA_INLIST;
+ ECORE_MAGIC;
+ Ecore_Task_Cb func;
+ void *data;
+ int references;
+ Eina_Bool delete_me : 1;
+};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Idle_Exiter);
+
static Ecore_Idle_Exiter *idle_exiters = NULL;
static Ecore_Idle_Exiter *idle_exiter_current = NULL;
static int idle_exiters_delete_me = 0;
#include "Ecore.h"
#include "ecore_private.h"
+struct _Ecore_Idler
+{
+ EINA_INLIST;
+ ECORE_MAGIC;
+ Ecore_Task_Cb func;
+ void *data;
+ int references;
+ Eina_Bool delete_me : 1;
+};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Idler);
+
static Ecore_Idler *idlers = NULL;
static Ecore_Idler *idler_current = NULL;
static int idlers_delete_me = 0;
static int ecore_event_job_type = 0;
static Ecore_Event_Handler *_ecore_job_handler = NULL;
+struct _Ecore_Job
+{
+ ECORE_MAGIC;
+ Ecore_Event *event;
+ Ecore_Cb func;
+ void *data;
+};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Job);
+
void
_ecore_job_init(void)
{
#define NS_PER_SEC (1000.0 * 1000.0 * 1000.0)
+struct _Ecore_Fd_Handler
+{
+ EINA_INLIST;
+ ECORE_MAGIC;
+ Ecore_Fd_Handler *next_ready;
+ int fd;
+ Ecore_Fd_Handler_Flags flags;
+ Ecore_Fd_Cb func;
+ void *data;
+ Ecore_Fd_Cb buf_func;
+ void *buf_data;
+ Ecore_Fd_Prep_Cb prep_func;
+ void *prep_data;
+ int references;
+ Eina_Bool read_active : 1;
+ Eina_Bool write_active : 1;
+ Eina_Bool error_active : 1;
+ Eina_Bool delete_me : 1;
+#if defined(USE_G_MAIN_LOOP)
+ GPollFD gfd;
+#endif
+};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Fd_Handler);
+
+#ifdef _WIN32
+struct _Ecore_Win32_Handler
+{
+ EINA_INLIST;
+ ECORE_MAGIC;
+ HANDLE h;
+ Ecore_Win32_Handle_Cb func;
+ void *data;
+ int references;
+ Eina_Bool delete_me : 1;
+};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Win32_Handler);
+#endif
+
#ifndef USE_G_MAIN_LOOP
static int _ecore_main_select(double timeout);
#endif
#endif /* ! _WIN32 */
+struct _Ecore_Pipe
+{
+ ECORE_MAGIC;
+ int fd_read;
+ int fd_write;
+ Ecore_Fd_Handler *fd_handler;
+ const void *data;
+ Ecore_Pipe_Cb handler;
+ unsigned int len;
+ int handling;
+ size_t already_read;
+ void *passed_data;
+ int message;
+ Eina_Bool delete_me : 1;
+};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Pipe);
static Eina_Bool _ecore_pipe_read(void *data,
Ecore_Fd_Handler *fd_handler);
#include "Ecore.h"
#include "ecore_private.h"
+struct _Ecore_Poller
+{
+ EINA_INLIST;
+ ECORE_MAGIC;
+ int ibit;
+ unsigned char delete_me : 1;
+ Ecore_Task_Cb func;
+ void *data;
+};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Poller);
+
static Ecore_Timer *timer = NULL;
static int min_interval = -1;
static int interval_incr = 0;
#define ECORE_MAGIC_CHECK(d, m) ((d) && ((d)->__magic == (m)))
#define ECORE_MAGIC_FAIL(d, m, fn) _ecore_magic_fail((d), (d) ? (d)->__magic : 0, (m), (fn));
-#include "ecore_types.h"
-
/* undef the following, we want our version */
#undef FREE
#define FREE(ptr) free(ptr); ptr = NULL;
#define GENERIC_ALLOC_FREE_HEADER(TYPE, Type) \
TYPE *Type##_calloc(unsigned int); \
void Type##_mp_free(TYPE *e);
+#define GENERIC_ALLOC_SIZE_DECLARE(TYPE) \
+ size_t _ecore_sizeof_##TYPE = sizeof (TYPE);
GENERIC_ALLOC_FREE_HEADER(Ecore_Animator, ecore_animator);
GENERIC_ALLOC_FREE_HEADER(Ecore_Event_Handler, ecore_event_handler);
#include "Ecore.h"
#include "ecore_private.h"
+#ifdef WANT_ECORE_TIMER_DUMP
+# include <string.h>
+# include <execinfo.h>
+# define ECORE_TIMER_DEBUG_BT_NUM 64
+typedef void (*Ecore_Timer_Bt_Func)();
+#endif
+
+struct _Ecore_Timer
+{
+ EINA_INLIST;
+ ECORE_MAGIC;
+ double in;
+ double at;
+ double pending;
+ Ecore_Task_Cb func;
+ void *data;
+
+#ifdef WANT_ECORE_TIMER_DUMP
+ Ecore_Timer_Bt_Func timer_bt[ECORE_TIMER_DEBUG_BT_NUM];
+ int timer_bt_num;
+#endif
+
+ int references;
+ unsigned char delete_me : 1;
+ unsigned char just_added : 1;
+ unsigned char frozen : 1;
+};
+GENERIC_ALLOC_SIZE_DECLARE(Ecore_Timer);
+
static void _ecore_timer_set(Ecore_Timer *timer,
double at,
double in,
+++ /dev/null
-#ifndef ECORE_TYPES_H
-#define ECORE_TYPES_H
-
-#ifdef WANT_ECORE_TIMER_DUMP
-# include <string.h>
-# include <execinfo.h>
-# define ECORE_TIMER_DEBUG_BT_NUM 64
-typedef void (*Ecore_Timer_Bt_Func)();
-#endif
-
-struct _Ecore_Animator
-{
- EINA_INLIST;
- ECORE_MAGIC;
-
- Ecore_Task_Cb func;
- void *data;
-
- double start, run;
- Ecore_Timeline_Cb run_func;
- void *run_data;
-
- Eina_Bool delete_me : 1;
- Eina_Bool suspended : 1;
-};
-
-struct _Ecore_Event_Handler
-{
- EINA_INLIST;
- ECORE_MAGIC;
- int type;
- Ecore_Event_Handler_Cb func;
- void *data;
- int references;
- Eina_Bool delete_me : 1;
-};
-
-struct _Ecore_Event_Filter
-{
- EINA_INLIST;
- ECORE_MAGIC;
- Ecore_Data_Cb func_start;
- Ecore_Filter_Cb func_filter;
- Ecore_End_Cb func_end;
- void *loop_data;
- void *data;
- int references;
- Eina_Bool delete_me : 1;
-};
-
-struct _Ecore_Event
-{
- EINA_INLIST;
- ECORE_MAGIC;
- int type;
- void *event;
- Ecore_End_Cb func_free;
- void *data;
- int references;
- Eina_Bool delete_me : 1;
-};
-
-struct _Ecore_Idle_Enterer
-{
- EINA_INLIST;
- ECORE_MAGIC;
- Ecore_Task_Cb func;
- void *data;
- int references;
- Eina_Bool delete_me : 1;
-};
-
-struct _Ecore_Idle_Exiter
-{
- EINA_INLIST;
- ECORE_MAGIC;
- Ecore_Task_Cb func;
- void *data;
- int references;
- Eina_Bool delete_me : 1;
-};
-
-struct _Ecore_Idler
-{
- EINA_INLIST;
- ECORE_MAGIC;
- Ecore_Task_Cb func;
- void *data;
- int references;
- Eina_Bool delete_me : 1;
-};
-
-struct _Ecore_Job
-{
- ECORE_MAGIC;
- Ecore_Event *event;
- Ecore_Cb func;
- void *data;
-};
-
-struct _Ecore_Fd_Handler
-{
- EINA_INLIST;
- ECORE_MAGIC;
- Ecore_Fd_Handler *next_ready;
- int fd;
- Ecore_Fd_Handler_Flags flags;
- Ecore_Fd_Cb func;
- void *data;
- Ecore_Fd_Cb buf_func;
- void *buf_data;
- Ecore_Fd_Prep_Cb prep_func;
- void *prep_data;
- int references;
- Eina_Bool read_active : 1;
- Eina_Bool write_active : 1;
- Eina_Bool error_active : 1;
- Eina_Bool delete_me : 1;
-#if defined(USE_G_MAIN_LOOP)
- GPollFD gfd;
-#endif
-};
-
-#ifdef _WIN32
-struct _Ecore_Win32_Handler
-{
- EINA_INLIST;
- ECORE_MAGIC;
- HANDLE h;
- Ecore_Win32_Handle_Cb func;
- void *data;
- int references;
- Eina_Bool delete_me : 1;
-};
-#endif
-
-struct _Ecore_Pipe
-{
- ECORE_MAGIC;
- int fd_read;
- int fd_write;
- Ecore_Fd_Handler *fd_handler;
- const void *data;
- Ecore_Pipe_Cb handler;
- unsigned int len;
- int handling;
- size_t already_read;
- void *passed_data;
- int message;
- Eina_Bool delete_me : 1;
-};
-
-struct _Ecore_Poller
-{
- EINA_INLIST;
- ECORE_MAGIC;
- int ibit;
- unsigned char delete_me : 1;
- Ecore_Task_Cb func;
- void *data;
-};
-
-struct _Ecore_Timer
-{
- EINA_INLIST;
- ECORE_MAGIC;
- double in;
- double at;
- double pending;
- Ecore_Task_Cb func;
- void *data;
-
-#ifdef WANT_ECORE_TIMER_DUMP
- Ecore_Timer_Bt_Func timer_bt[ECORE_TIMER_DEBUG_BT_NUM];
- int timer_bt_num;
-#endif
-
- int references;
- unsigned char delete_me : 1;
- unsigned char just_added : 1;
- unsigned char frozen : 1;
-};
-
-#endif