seoz pushed a commit to branch master.
commit 3072dab12f12fe83fb5a628d15efd5cded11787f
Author: Daniel Juyung Seo <[email protected]>
Date: Wed May 29 20:11:47 2013 +0900
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, ...
---
src/lib/elc_player.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/lib/elc_player.c b/src/lib/elc_player.c
index 4abe26c..8aed1f9 100644
--- a/src/lib/elc_player.c
+++ b/src/lib/elc_player.c
@@ -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());
}
--
------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1