edje: Avoid string duplication when possible.
authorWoochanlee <wc0917.lee@samsung.com>
Tue, 7 Jul 2020 10:20:53 +0000 (11:20 +0100)
committerJongmin Lee <jm105.lee@samsung.com>
Thu, 9 Jul 2020 22:19:19 +0000 (07:19 +0900)
Summary:
Most use case the part name dosen't contain the recursive name
so we don't have to go through expensive eina_string_split operation.

Reviewers: smohanty, cedric, Hermet, raster

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12045

src/lib/edje/edje_util.c

index c1bbaf6..972bf40 100644 (file)
@@ -5838,17 +5838,23 @@ _edje_real_part_text_text_source_description_get(Edje_Real_Part *ep, Edje_Real_P
 Edje_Real_Part *
 _edje_real_part_recursive_get(Edje **ed, const char *part)
 {
-   Edje_Real_Part *rp;
-   char **path;
+   if ((*ed)->collection && (*ed)->collection->alias)
+     {
+        Edje_Real_Part *rp;
+        char **path;
 
-   path = eina_str_split(part, EDJE_PART_PATH_SEPARATOR_STRING, 0);
-   if (!path) return NULL;
+        path = eina_str_split(part, EDJE_PART_PATH_SEPARATOR_STRING, 0);
+        if (!path) return NULL;
 
-   rp = _edje_real_part_recursive_get_helper(ed, path);
+        rp = _edje_real_part_recursive_get_helper(ed, path);
+
+        free(*path);
+        free(path);
+
+        return rp;
+     }
 
-   free(*path);
-   free(path);
-   return rp;
+   return _edje_real_part_get(*ed, part);;
 }
 
 Evas_Object *