elc_player: ELM_SAFE_FREE adoption.

1. ELM_FREE_FUNC -> ELM_SAFE_FREE
2. There were a lot of suggestions and consideration in the mailing list.
ELM_SAFE_FREE will be used only when it checks the pointer, deletes it, and initializes it to NULL.

ex)
if (timer)
  {
     ecore_timer_del(timer);
     timer = NULL;
  }
=>
ELM_SAFE_FREE(timer, ecore_timer_del);

My first aim was to remove many human mistakes but it looks like people want more optimized code in a code level.
So this macro will be used only for reducing 5 lines of code into 1 line.
Otherwise, I will just call xxx_del() manually.

3. ELM_SAFE_FREE can be used for other del or free functions such as ecore_job_del, ecore_animator_del, eina_stringshare_del, free, ...
This commit is contained in:
Daniel Juyung Seo 2013-05-29 20:11:47 +09:00
parent 5e6538eda1
commit 6ac249e370
1 changed files with 3 additions and 3 deletions

View File

@ -175,7 +175,7 @@ _update_slider(void *data,
elm_slider_min_max_set(sd->slider, 0, length);
elm_slider_value_set(sd->slider, pos);
sd->last_update_time = ecore_loop_time_get();
ELM_FREE_FUNC(sd->delay_update, ecore_timer_del);
ELM_SAFE_FREE(sd->delay_update, ecore_timer_del);
}
static Eina_Bool
@ -198,7 +198,7 @@ _update_frame(void *data,
if ((ecore_loop_time_get() - sd->last_update_time) < 0.25)
{
ELM_FREE_FUNC(sd->delay_update, ecore_timer_del);
if (sd->delay_update) ecore_timer_del(sd->delay_update);
sd->delay_update = ecore_timer_add(0.30, _update_delay, data);
return;
}
@ -551,7 +551,7 @@ _elm_player_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
{
Elm_Player_Smart_Data *sd = _pd;
ELM_FREE_FUNC(sd->delay_update, ecore_timer_del);
if (sd->delay_update) ecore_timer_del(sd->delay_update);
eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
}