summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsubhransu mohanty <sub.mohanty@samsung.com>2019-08-27 07:42:14 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-08-27 07:42:14 -0400
commitfcc235b3297d1e1cc738543e4a803d31e474b6d4 (patch)
tree02175e77895e8977024bd86fd073fd9332ee2cba
parentb78b0c9248d0b2eaf2a0baef6183d6c5d8e8ad75 (diff)
downloadefl-fcc235b3297d1e1cc738543e4a803d31e474b6d4.tar.gz
edje/optimization: replace eina_list with eina_array.
Summary: We were creating 3 eina_list and destroying inside a for loop. replace that with creating a single eina_array at start and use eina_array_clean() function ro reuse the array. Reviewers: Hermet, zmike, cedric, raster Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9745
-rw-r--r--src/lib/edje/edje_cache.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/lib/edje/edje_cache.c b/src/lib/edje/edje_cache.c
index 986ee71ab9..24e18b20c6 100644
--- a/src/lib/edje/edje_cache.c
+++ b/src/lib/edje/edje_cache.c
@@ -165,7 +165,9 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
unsigned int j;
Edje_Part *ep;
- Eina_List *hist;
+ Eina_Array hist;
+
+ eina_array_step_set(&hist, sizeof(Eina_Array), 5);
for (j = 0; j < edc->parts_count; ++j)
{
@@ -173,8 +175,7 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
ep = edc->parts[j];
/* Register any color classes in this parts descriptions. */
- hist = NULL;
- hist = eina_list_append(hist, ep);
+ eina_array_push(&hist, ep);
ep2 = ep;
while (ep2->dragable.confine_id >= 0)
{
@@ -186,17 +187,17 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
}
ep2 = edc->parts[ep2->dragable.confine_id];
- if (eina_list_data_find(hist, ep2))
+ if (eina_array_find(&hist, ep2, NULL))
{
ERR("confine_to loops. invalidating loop.");
ep2->dragable.confine_id = -1;
break;
}
- hist = eina_list_append(hist, ep2);
+ eina_array_push(&hist, ep2);
}
- eina_list_free(hist);
- hist = NULL;
- hist = eina_list_append(hist, ep);
+ eina_array_clean(&hist);
+
+ eina_array_push(&hist, ep);
ep2 = ep;
while (ep2->dragable.event_id >= 0)
{
@@ -218,17 +219,17 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
break;
}
- if (eina_list_data_find(hist, ep2))
+ if (eina_array_find(&hist, ep2, NULL))
{
ERR("events_to loops. invalidating loop.");
ep2->dragable.event_id = -1;
break;
}
- hist = eina_list_append(hist, ep2);
+ eina_array_push(&hist, ep2);
}
- eina_list_free(hist);
- hist = NULL;
- hist = eina_list_append(hist, ep);
+ eina_array_clean(&hist);
+
+ eina_array_push(&hist, ep);
ep2 = ep;
while (ep2->clip_to_id >= 0)
{
@@ -240,17 +241,17 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
}
ep2 = edc->parts[ep2->clip_to_id];
- if (eina_list_data_find(hist, ep2))
+ if (eina_array_find(&hist, ep2, NULL))
{
ERR("clip_to loops. invalidating loop.");
ep2->clip_to_id = -1;
break;
}
- hist = eina_list_append(hist, ep2);
+ eina_array_push(&hist, ep2);
}
- eina_list_free(hist);
- hist = NULL;
+ eina_array_clean(&hist);
}
+ eina_array_flush(&hist);
}
static Edje_Part_Collection *