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
This commit is contained in:
subhransu mohanty 2019-08-27 07:42:14 -04:00 committed by Mike Blumenkrantz
parent b78b0c9248
commit fcc235b329
1 changed files with 18 additions and 17 deletions

View File

@ -165,7 +165,9 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
unsigned int j; unsigned int j;
Edje_Part *ep; 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) for (j = 0; j < edc->parts_count; ++j)
{ {
@ -173,8 +175,7 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
ep = edc->parts[j]; ep = edc->parts[j];
/* Register any color classes in this parts descriptions. */ /* Register any color classes in this parts descriptions. */
hist = NULL; eina_array_push(&hist, ep);
hist = eina_list_append(hist, ep);
ep2 = ep; ep2 = ep;
while (ep2->dragable.confine_id >= 0) 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]; 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."); ERR("confine_to loops. invalidating loop.");
ep2->dragable.confine_id = -1; ep2->dragable.confine_id = -1;
break; break;
} }
hist = eina_list_append(hist, ep2); eina_array_push(&hist, ep2);
} }
eina_list_free(hist); eina_array_clean(&hist);
hist = NULL;
hist = eina_list_append(hist, ep); eina_array_push(&hist, ep);
ep2 = ep; ep2 = ep;
while (ep2->dragable.event_id >= 0) while (ep2->dragable.event_id >= 0)
{ {
@ -218,17 +219,17 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
break; break;
} }
if (eina_list_data_find(hist, ep2)) if (eina_array_find(&hist, ep2, NULL))
{ {
ERR("events_to loops. invalidating loop."); ERR("events_to loops. invalidating loop.");
ep2->dragable.event_id = -1; ep2->dragable.event_id = -1;
break; break;
} }
hist = eina_list_append(hist, ep2); eina_array_push(&hist, ep2);
} }
eina_list_free(hist); eina_array_clean(&hist);
hist = NULL;
hist = eina_list_append(hist, ep); eina_array_push(&hist, ep);
ep2 = ep; ep2 = ep;
while (ep2->clip_to_id >= 0) 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]; 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."); ERR("clip_to loops. invalidating loop.");
ep2->clip_to_id = -1; ep2->clip_to_id = -1;
break; break;
} }
hist = eina_list_append(hist, ep2); eina_array_push(&hist, ep2);
} }
eina_list_free(hist); eina_array_clean(&hist);
hist = NULL;
} }
eina_array_flush(&hist);
} }
static Edje_Part_Collection * static Edje_Part_Collection *