netstar pushed a commit to branch master.

http://git.enlightenment.org/tools/edi.git/commit/?id=47ab991da9792b4a747d03d3927636891a2589ef

commit 47ab991da9792b4a747d03d3927636891a2589ef
Author: Al Poole <nets...@gmail.com>
Date:   Sun Sep 17 20:28:50 2017 +0100

    filepanel: don't duplicate unnecessary code and no need to memcpy.
    
    This is a small logic change that should be more efficient also.
---
 src/bin/edi_filepanel.c | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/bin/edi_filepanel.c b/src/bin/edi_filepanel.c
index 11f885f..eb2b9ac 100644
--- a/src/bin/edi_filepanel.c
+++ b/src/bin/edi_filepanel.c
@@ -163,7 +163,8 @@ _file_status_item_add(const char *path, Edi_Scm_Status_Code 
status)
      _file_status_item_delete(path);
 
    code = malloc(sizeof(Edi_Scm_Status_Code));
-   memcpy(code, &status, sizeof(Edi_Scm_Status_Code));
+
+   *code = status;
 
    eina_hash_add(_list_statuses, path, code);
 }
@@ -624,9 +625,7 @@ _text_get(void *data, Evas_Object *obj EINA_UNUSED, const 
char *source EINA_UNUS
 
    code = _file_status_item_find(sd->path);
    if (code)
-     {
-        return strdup(_file_status(sd->path, *code));
-     }
+     return strdup(_file_status(sd->path, *code));
 
    return strdup(basename((char *)sd->path));
 }
@@ -638,29 +637,27 @@ _content_get(void *data, Evas_Object *obj, const char 
*source)
    Edi_Dir_Data *sd = data;
    Evas_Object *ic;
    Edi_Scm_Status_Code *code;
-   const char *icon_name;
+   const char *icon_name = NULL;
 
    if (strcmp(source, "elm.swallow.icon"))
      return NULL;
 
-   provider = _get_provider_from_hashset(sd->path);
-
-   ic = elm_icon_add(obj);
-
    code = _file_status_item_find(sd->path);
    if (code)
+    icon_name = _icon_status(*code);
+
+   if (!icon_name)
      {
-        icon_name = _icon_status(*code);
-        elm_icon_standard_set(ic, icon_name);
-     }
-   else
-     {
+        provider = _get_provider_from_hashset(sd->path);
         if (provider)
-          elm_icon_standard_set(ic, provider->icon);
+          icon_name = provider->icon;
         else
-          elm_icon_standard_set(ic, "empty");
+          icon_name = "empty";
      }
 
+   ic = elm_icon_add(obj);
+   elm_icon_standard_set(ic, icon_name);
+
    evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
    evas_object_show(ic);
 

-- 


Reply via email to