forked from enlightenment/efl
evas: Use efl_data_scope_safe_get in evas events
This removes a few NULL + efl_isa safety checks.
This commit is contained in:
parent
b96722cfb8
commit
1729930db0
|
@ -251,7 +251,7 @@ _proxy_image_get(Evas_Image_Data *o)
|
|||
return NULL;
|
||||
|
||||
if (efl_isa(o->cur->source, EFL_CANVAS_IMAGE_INTERNAL_CLASS))
|
||||
source_img = efl_data_scope_get(o->cur->source, EFL_CANVAS_IMAGE_INTERNAL_CLASS);
|
||||
source_img = efl_data_scope_safe_get(o->cur->source, EFL_CANVAS_IMAGE_INTERNAL_CLASS);
|
||||
|
||||
if (source_img)
|
||||
return source_img->engine_data;
|
||||
|
|
|
@ -460,9 +460,7 @@ evas_object_event_callback_add(Evas_Object *eo_obj, Evas_Callback_Type type, Eva
|
|||
EAPI void
|
||||
evas_object_event_callback_priority_add(Evas_Object *eo_obj, Evas_Callback_Type type, Evas_Callback_Priority priority, Evas_Object_Event_Cb func, const void *data)
|
||||
{
|
||||
if(!eo_obj) return;
|
||||
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(eo_obj, EFL_CANVAS_OBJECT_CLASS));
|
||||
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
Evas_Object_Protected_Data *obj = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
Evas_Event_Cb_Wrapper_Info *cb_info;
|
||||
const Efl_Event_Description *desc;
|
||||
|
||||
|
@ -485,9 +483,7 @@ evas_object_event_callback_priority_add(Evas_Object *eo_obj, Evas_Callback_Type
|
|||
EAPI void *
|
||||
evas_object_event_callback_del(Evas_Object *eo_obj, Evas_Callback_Type type, Evas_Object_Event_Cb func)
|
||||
{
|
||||
if(!eo_obj) return NULL;
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(eo_obj, EFL_CANVAS_OBJECT_CLASS), NULL);
|
||||
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
Evas_Object_Protected_Data *obj = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
Evas_Event_Cb_Wrapper_Info *info;
|
||||
|
||||
if (!obj) return NULL;
|
||||
|
@ -514,9 +510,7 @@ evas_object_event_callback_del(Evas_Object *eo_obj, Evas_Callback_Type type, Eva
|
|||
EAPI void *
|
||||
evas_object_event_callback_del_full(Evas_Object *eo_obj, Evas_Callback_Type type, Evas_Object_Event_Cb func, const void *data)
|
||||
{
|
||||
if(!eo_obj) return NULL;
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(eo_obj, EFL_CANVAS_OBJECT_CLASS), NULL);
|
||||
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
Evas_Object_Protected_Data *obj = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
Evas_Event_Cb_Wrapper_Info *info;
|
||||
|
||||
if (!obj) return NULL;
|
||||
|
@ -550,12 +544,11 @@ evas_event_callback_add(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb func,
|
|||
EAPI void
|
||||
evas_event_callback_priority_add(Evas *eo_e, Evas_Callback_Type type, Evas_Callback_Priority priority, Evas_Event_Cb func, const void *data)
|
||||
{
|
||||
if(!eo_e) return;
|
||||
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(eo_e, EVAS_CANVAS_CLASS));
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Public_Data *e = efl_data_scope_safe_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Event_Cb_Wrapper_Info *cb_info;
|
||||
const Efl_Event_Description *desc;
|
||||
|
||||
if (!e) return;
|
||||
if (!func) return;
|
||||
|
||||
cb_info = calloc(1, sizeof(*cb_info));
|
||||
|
@ -573,9 +566,7 @@ evas_event_callback_priority_add(Evas *eo_e, Evas_Callback_Type type, Evas_Callb
|
|||
EAPI void *
|
||||
evas_event_callback_del(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb func)
|
||||
{
|
||||
if(!eo_e) return NULL;
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(eo_e, EVAS_CANVAS_CLASS), NULL);
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Public_Data *e = efl_data_scope_safe_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Event_Cb_Wrapper_Info *info;
|
||||
|
||||
if (!e) return NULL;
|
||||
|
@ -602,9 +593,7 @@ evas_event_callback_del(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb func)
|
|||
EAPI void *
|
||||
evas_event_callback_del_full(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb func, const void *data)
|
||||
{
|
||||
if(!eo_e) return NULL;
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(eo_e, EVAS_CANVAS_CLASS), NULL);
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Public_Data *e = efl_data_scope_safe_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Event_Cb_Wrapper_Info *info;
|
||||
|
||||
if (!e) return NULL;
|
||||
|
@ -631,9 +620,7 @@ evas_event_callback_del_full(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb
|
|||
EAPI void
|
||||
evas_post_event_callback_push(Evas *eo_e, Evas_Object_Event_Post_Cb func, const void *data)
|
||||
{
|
||||
if(!eo_e) return;
|
||||
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(eo_e, EVAS_CANVAS_CLASS));
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Public_Data *e = efl_data_scope_safe_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Post_Callback *pc;
|
||||
|
||||
if (!e || e->delete_me) return;
|
||||
|
@ -657,9 +644,7 @@ evas_post_event_callback_push(Evas *eo_e, Evas_Object_Event_Post_Cb func, const
|
|||
EAPI void
|
||||
evas_post_event_callback_remove(Evas *eo_e, Evas_Object_Event_Post_Cb func)
|
||||
{
|
||||
if(!eo_e) return;
|
||||
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(eo_e, EVAS_CANVAS_CLASS));
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Public_Data *e = efl_data_scope_safe_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Post_Callback *pc;
|
||||
Eina_List *l;
|
||||
|
||||
|
@ -677,9 +662,7 @@ evas_post_event_callback_remove(Evas *eo_e, Evas_Object_Event_Post_Cb func)
|
|||
EAPI void
|
||||
evas_post_event_callback_remove_full(Evas *eo_e, Evas_Object_Event_Post_Cb func, const void *data)
|
||||
{
|
||||
if(!eo_e) return;
|
||||
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(eo_e, EVAS_CANVAS_CLASS));
|
||||
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Public_Data *e = efl_data_scope_safe_get(eo_e, EVAS_CANVAS_CLASS);
|
||||
Evas_Post_Callback *pc;
|
||||
Eina_List *l;
|
||||
|
||||
|
|
|
@ -633,8 +633,7 @@ MAGIC_CHECK_FAILED(o, t, m)
|
|||
#endif
|
||||
|
||||
#define EVAS_LEGACY_API(_obj, _e, ...) \
|
||||
Evas_Public_Data *_e = (_obj && efl_isa(_obj, EVAS_CANVAS_CLASS)) ? \
|
||||
efl_data_scope_get(_obj, EVAS_CANVAS_CLASS) : NULL; \
|
||||
Evas_Public_Data *_e = efl_data_scope_safe_get((_obj), EVAS_CANVAS_CLASS); \
|
||||
if (!_e) return __VA_ARGS__
|
||||
|
||||
#define EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(cur, prev) \
|
||||
|
|
Loading…
Reference in New Issue