EAPI Eina_Bool _eo_call_resolve(const char *func_name, const Eo_Op op, Eo_Op_Call_Data *call, const char *file, int line);
// start of eo_do barrier, gets the object pointer and ref it, put it on the stask
- EAPI Eina_Bool _eo_do_start(const Eo *obj, const Eo_Class *cur_klass, Eina_Bool is_super, const char *file, const char *func, int line);
+ EAPI Eina_Bool _eo_do_start(const Eo *obj, const Eo_Class *cur_klass, Eina_Bool is_super, void *eo_stack);
// end of the eo_do barrier, unref the obj, move the stack pointer
-EAPI void _eo_do_end(void);
+EAPI void _eo_do_end(void *eo_stack);
// end of the eo_add. Calls finalize among others
-EAPI Eo * _eo_add_end(void);
+EAPI Eo * _eo_add_end(void *eo_stack);
+
+// XXX: We cheat and make it const to indicate to the compiler that the value never changes
+EAPI EINA_CONST void *_eo_stack_get(void);
// eo object method calls batch,
#define _eo_do_common(eoid, clsid, is_super, ...) \
do { \
- _eo_do_start(eoid, clsid, is_super, __FILE__, __FUNCTION__, __LINE__); \
+ _eo_do_start(eoid, clsid, is_super, _eo_stack_get()); \
__VA_ARGS__; \
- _eo_do_end(); \
+ _eo_do_end(_eo_stack_get()); \
} while (0)
#define _eo_do_common_ret(eoid, clsid, is_super, ret_tmp, func) \
( \
- _eo_do_start(eoid, clsid, is_super, __FILE__, __FUNCTION__, __LINE__), \
+ _eo_do_start(eoid, clsid, is_super, _eo_stack_get()), \
ret_tmp = func, \
- _eo_do_end(), \
+ _eo_do_end(_eo_stack_get()), \
ret_tmp \
)
#define _eo_add_common(klass, parent, is_ref, ...) \
( \
_eo_do_start(_eo_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref), \
- klass, EINA_FALSE, __FILE__, __FUNCTION__, __LINE__) \
+ klass, EINA_FALSE, _eo_stack_get()) \
, ##__VA_ARGS__, \
- (Eo *) _eo_add_end() \
+ (Eo *) _eo_add_end(_eo_stack_get()) \
)
/**
static Eo_Call_Stack *main_loop_stack = NULL;
-#define _EO_CALL_STACK_GET(is_main_loop) ((EINA_LIKELY(is_main_loop)) ? main_loop_stack : _eo_call_stack_get_thread())
+#define _EO_CALL_STACK_GET() ((EINA_LIKELY(eina_main_loop_is())) ? main_loop_stack : _eo_call_stack_get_thread())
static inline Eo_Call_Stack *
_eo_call_stack_get_thread(void)
return stack;
}
+EAPI EINA_CONST void *
+_eo_stack_get(void)
+{
+ return _EO_CALL_STACK_GET();
+}
+
static inline void
_eo_call_stack_resize(Eo_Call_Stack *stack, Eina_Bool grow)
{
}
EAPI Eina_Bool
-_eo_do_start(const Eo *eo_id, const Eo_Class *cur_klass_id, Eina_Bool is_super, const char *file EINA_UNUSED, const char *func EINA_UNUSED, int line EINA_UNUSED)
+_eo_do_start(const Eo *eo_id, const Eo_Class *cur_klass_id, Eina_Bool is_super, void *eo_stack)
{
Eina_Bool ret = EINA_TRUE;
Eo_Stack_Frame *fptr, *pfptr;
- Eo_Call_Stack *stack = _EO_CALL_STACK_GET(eina_main_loop_is());
+ Eo_Call_Stack *stack = eo_stack;
if (stack->frame_ptr == stack->last_frame)
_eo_call_stack_resize(stack, EINA_TRUE);
}
EAPI void
-_eo_do_end(void)
+_eo_do_end(void *eo_stack)
{
Eo_Stack_Frame *fptr;
- Eo_Call_Stack *stack = _EO_CALL_STACK_GET(eina_main_loop_is()); // Is it possible to extract information from the scope ?
+ Eo_Call_Stack *stack = eo_stack;
fptr = stack->frame_ptr;
const op_type_funcs *func;
Eina_Bool is_obj;
- fptr = _EO_CALL_STACK_GET(eina_main_loop_is())->frame_ptr;
+ fptr = _EO_CALL_STACK_GET()->frame_ptr;
if (EINA_UNLIKELY(!fptr->o.obj))
return EINA_FALSE;
}
static Eo *
-_eo_add_internal_end(Eo *eo_id)
+_eo_add_internal_end(Eo *eo_id, Eo_Call_Stack *stack)
{
Eo_Stack_Frame *fptr;
- Eo_Call_Stack *stack = _EO_CALL_STACK_GET(eina_main_loop_is());
fptr = stack->frame_ptr;
}
EAPI Eo *
-_eo_add_end(void)
+_eo_add_end(void *eo_stack)
{
Eo *ret = eo_finalize();
- ret = _eo_add_internal_end(ret);
- _eo_do_end();
+ ret = _eo_add_internal_end(ret, eo_stack);
+ _eo_do_end(eo_stack);
return ret;
}