seoz pushed a commit to branch master.

commit 70a196f6de4c8527d38814435d082629ece3ee28
Author: Daniel Juyung Seo <[email protected]>
Date:   Wed May 29 20:51:06 2013 +0900

    elm_entry.c: ELM_SAFE_FREE adoption.
    
    I splited ELM_SAFE_FREE refactoring patches. One commit per each file as 
recommended.
    For the detail, please refer 3072dab12f12fe83fb5a628d15efd5cded11787f.
---
 src/lib/elm_entry.c | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index 73f946f..dd2f11a 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -1382,7 +1382,7 @@ _mouse_down_cb(void *data,
    sd->downy = ev->canvas.y;
    if (ev->button == 1)
      {
-        ELM_FREE_FUNC(sd->longpress_timer, ecore_timer_del);
+        if (sd->longpress_timer) ecore_timer_del(sd->longpress_timer);
         sd->longpress_timer = ecore_timer_add
             (_elm_config->longpress_timeout, _long_press_cb, data);
      }
@@ -1406,7 +1406,7 @@ _mouse_up_cb(void *data,
    if (sd->disabled) return;
    if (ev->button == 1)
      {
-        ELM_FREE_FUNC(sd->longpress_timer, ecore_timer_del);
+        ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
      }
    else if ((ev->button == 3) && (!_elm_config->desktop_entry))
      {
@@ -1430,7 +1430,7 @@ _mouse_move_cb(void *data,
      {
         if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
           {
-             ELM_FREE_FUNC(sd->longpress_timer, ecore_timer_del);
+             ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
           }
         else if (sd->longpress_timer)
           {
@@ -1444,7 +1444,7 @@ _mouse_move_cb(void *data,
                  ((_elm_config->finger_size / 2) *
                   (_elm_config->finger_size / 2)))
                {
-                  ELM_FREE_FUNC(sd->longpress_timer, ecore_timer_del);
+                  ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
                }
           }
      }
@@ -1460,7 +1460,7 @@ _mouse_move_cb(void *data,
             ((_elm_config->finger_size / 2) *
              (_elm_config->finger_size / 2)))
           {
-             ELM_FREE_FUNC(sd->longpress_timer, ecore_timer_del);
+             ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
           }
      }
 }
@@ -1483,9 +1483,8 @@ _entry_changed_handle(void *data,
    evas_object_size_hint_min_set(data, -1, minh);
 
    elm_layout_sizing_eval(data);
-   if (sd->text) eina_stringshare_del(sd->text);
-   sd->text = NULL;
-   ELM_FREE_FUNC(sd->delay_write, ecore_timer_del);
+   ELM_SAFE_FREE(sd->text, eina_stringshare_del);
+   ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
    evas_event_thaw(evas_object_evas_get(data));
    evas_event_thaw_eval(evas_object_evas_get(data));
    if ((sd->auto_save) && (sd->file))
@@ -2229,8 +2228,7 @@ _text_append_idler(void *data)
    ELM_ENTRY_DATA_GET(obj, sd);
 
    evas_event_freeze(evas_object_evas_get(obj));
-   if (sd->text) eina_stringshare_del(sd->text);
-   sd->text = NULL;
+   ELM_SAFE_FREE(sd->text, eina_stringshare_del);
    sd->changed = EINA_TRUE;
 
    start = sd->append_text_position;
@@ -2533,8 +2531,7 @@ _elm_entry_smart_text_set(Eo *obj, void *_pd, va_list 
*list)
      }
 
    evas_event_freeze(evas_object_evas_get(obj));
-   if (sd->text) eina_stringshare_del(sd->text);
-   sd->text = NULL;
+   ELM_SAFE_FREE(sd->text, eina_stringshare_del);
    sd->changed = EINA_TRUE;
 
    /* Clear currently pending job if there is one */
@@ -2961,7 +2958,7 @@ _elm_entry_smart_del(Eo *obj, void *_pd, va_list *list 
EINA_UNUSED)
 
    if (sd->delay_write)
      {
-        ELM_FREE_FUNC(sd->delay_write, ecore_timer_del);
+        if (sd->delay_write) ecore_timer_del(sd->delay_write);
         if (sd->auto_save) _save_do(obj);
      }
 
@@ -2994,7 +2991,7 @@ _elm_entry_smart_del(Eo *obj, void *_pd, va_list *list 
EINA_UNUSED)
         sd->append_text_left = NULL;
         sd->append_text_idler = NULL;
      }
-   ELM_FREE_FUNC(sd->longpress_timer, ecore_timer_del);
+   if (sd->longpress_timer) ecore_timer_del(sd->longpress_timer);
    EINA_LIST_FREE(sd->items, it)
      {
         eina_stringshare_del(it->label);
@@ -3010,9 +3007,9 @@ _elm_entry_smart_del(Eo *obj, void *_pd, va_list *list 
EINA_UNUSED)
      {
         _filter_free(tf);
      }
-   ELM_FREE_FUNC(sd->delay_write, ecore_timer_del);
-   ELM_FREE_FUNC(sd->input_panel_imdata, free);
-   ELM_FREE_FUNC(sd->anchor_hover.hover_style, eina_stringshare_del);
+   if (sd->delay_write) ecore_timer_del(sd->delay_write);
+   if (sd->input_panel_imdata) free(sd->input_panel_imdata);
+   if (sd->anchor_hover.hover_style) 
eina_stringshare_del(sd->anchor_hover.hover_style);
 
    evas_event_thaw(evas_object_evas_get(obj));
    evas_event_thaw_eval(evas_object_evas_get(obj));
@@ -4395,7 +4392,7 @@ _file_set(Eo *obj, void *_pd, va_list *list)
 
    Elm_Entry_Smart_Data *sd = _pd;
 
-   ELM_FREE_FUNC(sd->delay_write, ecore_timer_del);
+   ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
    if (sd->auto_save) _save_do(obj);
    eina_stringshare_replace(&sd->file, file);
    sd->format = format;
@@ -4435,7 +4432,7 @@ _file_save(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
 {
    Elm_Entry_Smart_Data *sd = _pd;
 
-   ELM_FREE_FUNC(sd->delay_write, ecore_timer_del);
+   ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
    _save_do(obj);
    sd->delay_write = ecore_timer_add(2.0, _delay_write, obj);
 }

-- 

------------------------------------------------------------------------------
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

Reply via email to