elm_interface_scrollable.c: ELM_SAFE_FREE adoption.
authorDaniel Juyung Seo <seojuyung2@gmail.com>
Wed, 29 May 2013 11:58:29 +0000 (20:58 +0900)
committerDaniel Juyung Seo <seojuyung2@gmail.com>
Wed, 29 May 2013 11:58:29 +0000 (20:58 +0900)
I splited ELM_SAFE_FREE refactoring patches. One commit per each file as recommended.
For the detail, please refer 3072dab12f12fe83fb5a628d15efd5cded11787f.

src/lib/elm_interface_scrollable.c

index e34f17f..0cff76b 100644 (file)
@@ -1298,7 +1298,7 @@ _elm_scroll_momentum_end(Elm_Scrollable_Smart_Interface_Data *sid)
         eo_do(sid->obj, elm_scrollable_interface_content_pos_get(&px, &py));
         _elm_scroll_wanted_coordinates_update(sid, px, py);
 
-        ELM_FREE_FUNC(sid->down.momentum_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.momentum_animator, ecore_animator_del);
         sid->down.bounce_x_hold = EINA_FALSE;
         sid->down.bounce_y_hold = EINA_FALSE;
         sid->down.ax = 0;
@@ -1437,13 +1437,13 @@ _elm_scroll_bounce_eval(Elm_Scrollable_Smart_Interface_Data *sid)
    if (sid->down.now) return;  // down bounce while still held down
    if (sid->down.onhold_animator)
      {
-        ELM_FREE_FUNC(sid->down.onhold_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.onhold_animator, ecore_animator_del);
         if (sid->content_info.resized)
           _elm_scroll_wanted_region_set(sid->obj);
      }
    if (sid->down.hold_animator)
      {
-        ELM_FREE_FUNC(sid->down.onhold_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.onhold_animator, ecore_animator_del);
         if (sid->content_info.resized)
           _elm_scroll_wanted_region_set(sid->obj);
      }
@@ -1465,7 +1465,7 @@ _elm_scroll_bounce_eval(Elm_Scrollable_Smart_Interface_Data *sid)
           {
              if (sid->bouncemex)
                {
-                  ELM_FREE_FUNC(sid->scrollto.x.animator, ecore_animator_del);
+                  if (sid->scrollto.x.animator) ecore_animator_del(sid->scrollto.x.animator);
                   sid->down.bounce_x_animator =
                     ecore_animator_add(_elm_scroll_bounce_x_animator, sid->obj);
                   sid->down.anim_start2 = ecore_loop_time_get();
@@ -1485,7 +1485,7 @@ _elm_scroll_bounce_eval(Elm_Scrollable_Smart_Interface_Data *sid)
           {
              if (sid->bouncemey)
                {
-                  ELM_FREE_FUNC(sid->scrollto.y.animator, ecore_animator_del);
+                  if (sid->scrollto.y.animator) ecore_animator_del(sid->scrollto.y.animator);
                   sid->down.bounce_y_animator =
                     ecore_animator_add(_elm_scroll_bounce_y_animator, sid->obj);
                   sid->down.anim_start3 = ecore_loop_time_get();
@@ -1744,32 +1744,32 @@ _elm_scroll_content_region_show_internal(Evas_Object *obj,
      {
         _elm_scroll_anim_stop(sid);
      }
-   ELM_FREE_FUNC(sid->scrollto.x.animator, ecore_animator_del);
-   ELM_FREE_FUNC(sid->scrollto.y.animator, ecore_animator_del);
+   ELM_SAFE_FREE(sid->scrollto.x.animator, ecore_animator_del);
+   ELM_SAFE_FREE(sid->scrollto.y.animator, ecore_animator_del);
    if (sid->down.bounce_x_animator)
      {
-        ELM_FREE_FUNC(sid->down.bounce_x_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.bounce_x_animator, ecore_animator_del);
         sid->bouncemex = EINA_FALSE;
         if (sid->content_info.resized)
           _elm_scroll_wanted_region_set(sid->obj);
      }
    if (sid->down.bounce_y_animator)
      {
-        ELM_FREE_FUNC(sid->down.bounce_y_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.bounce_y_animator, ecore_animator_del);
         sid->bouncemey = EINA_FALSE;
         if (sid->content_info.resized)
           _elm_scroll_wanted_region_set(sid->obj);
      }
    if (sid->down.hold_animator)
      {
-        ELM_FREE_FUNC(sid->down.hold_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.hold_animator, ecore_animator_del);
         _elm_scroll_drag_stop(sid);
         if (sid->content_info.resized)
           _elm_scroll_wanted_region_set(sid->obj);
      }
    if (sid->down.momentum_animator)
      {
-        ELM_FREE_FUNC(sid->down.momentum_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.momentum_animator, ecore_animator_del);
         sid->down.bounce_x_hold = EINA_FALSE;
         sid->down.bounce_y_hold = EINA_FALSE;
         sid->down.ax = 0;
@@ -1928,18 +1928,18 @@ _elm_scroll_wheel_event_cb(void *data,
      {
         _elm_scroll_anim_stop(sid);
      }
-   ELM_FREE_FUNC(sid->scrollto.x.animator, ecore_animator_del);
-   ELM_FREE_FUNC(sid->scrollto.y.animator, ecore_animator_del);
+   ELM_SAFE_FREE(sid->scrollto.x.animator, ecore_animator_del);
+   ELM_SAFE_FREE(sid->scrollto.y.animator, ecore_animator_del);
    if (sid->down.bounce_x_animator)
      {
-        ELM_FREE_FUNC(sid->down.bounce_x_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.bounce_x_animator, ecore_animator_del);
         sid->bouncemex = EINA_FALSE;
         if (sid->content_info.resized)
           _elm_scroll_wanted_region_set(sid->obj);
      }
    if (sid->down.bounce_y_animator)
      {
-        ELM_FREE_FUNC(sid->down.bounce_y_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.bounce_y_animator, ecore_animator_del);
         sid->bouncemey = EINA_FALSE;
         if (sid->content_info.resized)
           _elm_scroll_wanted_region_set(sid->obj);
@@ -2264,7 +2264,7 @@ _elm_scroll_scroll_to_y(Elm_Scrollable_Smart_Interface_Data *sid,
      }
    if (sid->down.bounce_y_animator)
      {
-        ELM_FREE_FUNC(sid->down.bounce_y_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.bounce_y_animator, ecore_animator_del);
         _elm_scroll_momentum_end(sid);
         if (sid->content_info.resized)
           _elm_scroll_wanted_region_set(sid->obj);
@@ -2308,7 +2308,7 @@ _elm_scroll_scroll_to_x(Elm_Scrollable_Smart_Interface_Data *sid,
      }
    if (sid->down.bounce_x_animator)
      {
-        ELM_FREE_FUNC(sid->down.bounce_x_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.bounce_x_animator, ecore_animator_del);
         _elm_scroll_momentum_end(sid);
         if (sid->content_info.resized)
           _elm_scroll_wanted_region_set(sid->obj);
@@ -2349,7 +2349,7 @@ _elm_scroll_mouse_up_event_cb(void *data,
      {
         if (sid->down.onhold_animator)
           {
-             ELM_FREE_FUNC(sid->down.onhold_animator, ecore_animator_del);
+             ELM_SAFE_FREE(sid->down.onhold_animator, ecore_animator_del);
              if (sid->content_info.resized)
                _elm_scroll_wanted_region_set(sid->obj);
           }
@@ -2548,7 +2548,7 @@ _elm_scroll_mouse_up_event_cb(void *data,
           }
         if (sid->down.hold_animator)
           {
-             ELM_FREE_FUNC(sid->down.onhold_animator, ecore_animator_del);
+             ELM_SAFE_FREE(sid->down.onhold_animator, ecore_animator_del);
              if (sid->content_info.resized)
                _elm_scroll_wanted_region_set(sid->obj);
           }
@@ -2615,32 +2615,32 @@ _elm_scroll_mouse_down_event_cb(void *data,
         sid->down.hold = EINA_TRUE;
         _elm_scroll_anim_stop(sid);
      }
-   ELM_FREE_FUNC(sid->scrollto.x.animator, ecore_animator_del);
-   ELM_FREE_FUNC(sid->scrollto.y.animator, ecore_animator_del);
+   ELM_SAFE_FREE(sid->scrollto.x.animator, ecore_animator_del);
+   ELM_SAFE_FREE(sid->scrollto.y.animator, ecore_animator_del);
    if (sid->down.bounce_x_animator)
      {
-        ELM_FREE_FUNC(sid->down.bounce_x_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.bounce_x_animator, ecore_animator_del);
         sid->bouncemex = EINA_FALSE;
         if (sid->content_info.resized)
           _elm_scroll_wanted_region_set(sid->obj);
      }
    if (sid->down.bounce_y_animator)
      {
-        ELM_FREE_FUNC(sid->down.bounce_y_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.bounce_y_animator, ecore_animator_del);
         sid->bouncemey = EINA_FALSE;
         if (sid->content_info.resized)
           _elm_scroll_wanted_region_set(sid->obj);
      }
    if (sid->down.hold_animator)
      {
-        ELM_FREE_FUNC(sid->down.hold_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.hold_animator, ecore_animator_del);
         _elm_scroll_drag_stop(sid);
         if (sid->content_info.resized)
           _elm_scroll_wanted_region_set(sid->obj);
      }
    if (sid->down.momentum_animator)
      {
-        ELM_FREE_FUNC(sid->down.momentum_animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->down.momentum_animator, ecore_animator_del);
         sid->down.bounce_x_hold = EINA_FALSE;
         sid->down.bounce_y_hold = EINA_FALSE;
         sid->down.ax = 0;
@@ -3021,7 +3021,7 @@ _elm_scroll_mouse_move_event_cb(void *data,
        !(sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL))
      {
         Evas_Coord px;
-        ELM_FREE_FUNC(sid->scrollto.x.animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->scrollto.x.animator, ecore_animator_del);
         eo_do(sid->pan_obj, elm_obj_pan_pos_get(&px, NULL));
         sid->down.sx = px;
         sid->down.x = sid->down.history[0].x;
@@ -3031,7 +3031,7 @@ _elm_scroll_mouse_move_event_cb(void *data,
        !(sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL))
      {
         Evas_Coord py;
-        ELM_FREE_FUNC(sid->scrollto.y.animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->scrollto.y.animator, ecore_animator_del);
         eo_do(sid->pan_obj, elm_obj_pan_pos_get(NULL, &py));
         sid->down.sy = py;
         sid->down.y = sid->down.history[0].y;
@@ -3310,7 +3310,7 @@ _elm_scroll_mouse_move_event_cb(void *data,
           {
              if (sid->down.onhold_animator)
                {
-                  ELM_FREE_FUNC(sid->down.onhold_animator, ecore_animator_del);
+                  ELM_SAFE_FREE(sid->down.onhold_animator, ecore_animator_del);
                   if (sid->content_info.resized)
                     _elm_scroll_wanted_region_set(sid->obj);
                }
@@ -3936,7 +3936,7 @@ _elm_scroll_momentum_animator_disabled_set(Eo *obj EINA_UNUSED, void *_pd EINA_U
      {
         if (sid->down.momentum_animator)
           {
-             ELM_FREE_FUNC(sid->down.momentum_animator, ecore_animator_del);
+             ELM_SAFE_FREE(sid->down.momentum_animator, ecore_animator_del);
              if (sid->content_info.resized)
                _elm_scroll_wanted_region_set(sid->obj);
           }
@@ -3960,8 +3960,8 @@ _elm_scroll_bounce_animator_disabled_set(Eo *obj EINA_UNUSED, void *_pd, va_list
    sid->bounce_animator_disabled = disabled;
    if (sid->bounce_animator_disabled)
      {
-        ELM_FREE_FUNC(sid->scrollto.x.animator, ecore_animator_del);
-        ELM_FREE_FUNC(sid->scrollto.y.animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->scrollto.x.animator, ecore_animator_del);
+        ELM_SAFE_FREE(sid->scrollto.y.animator, ecore_animator_del);
      }
 }
 
@@ -4135,7 +4135,7 @@ _elm_scroll_freeze_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
      {
         if (sid->down.onhold_animator)
           {
-             ELM_FREE_FUNC(sid->down.onhold_animator, ecore_animator_del);
+             ELM_SAFE_FREE(sid->down.onhold_animator, ecore_animator_del);
              if (sid->content_info.resized)
                _elm_scroll_wanted_region_set(sid->obj);
           }
@@ -4481,13 +4481,13 @@ _elm_scroll_interface_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
    eo_do(obj, elm_scrollable_interface_content_set(NULL));
    if (!sid->extern_pan) evas_object_del(sid->pan_obj);
 
-   ELM_FREE_FUNC(sid->down.hold_animator, ecore_animator_del);
-   ELM_FREE_FUNC(sid->down.onhold_animator, ecore_animator_del);
-   ELM_FREE_FUNC(sid->down.momentum_animator, ecore_animator_del);
-   ELM_FREE_FUNC(sid->down.bounce_x_animator, ecore_animator_del);
-   ELM_FREE_FUNC(sid->down.bounce_y_animator, ecore_animator_del);
-   ELM_FREE_FUNC(sid->scrollto.x.animator, ecore_animator_del);
-   ELM_FREE_FUNC(sid->scrollto.y.animator, ecore_animator_del);
+   if (sid->down.hold_animator) ecore_animator_del(sid->down.hold_animator);
+   if (sid->down.onhold_animator) ecore_animator_del(sid->down.onhold_animator);
+   if (sid->down.momentum_animator) ecore_animator_del(sid->down.momentum_animator);
+   if (sid->down.bounce_x_animator) ecore_animator_del(sid->down.bounce_x_animator);
+   if (sid->down.bounce_y_animator) ecore_animator_del(sid->down.bounce_y_animator);
+   if (sid->scrollto.x.animator) ecore_animator_del(sid->scrollto.x.animator);
+   if (sid->scrollto.y.animator) ecore_animator_del(sid->scrollto.y.animator);
 }
 
 static void