cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a31102ab4317a464559d3300097b3051d857d6eb

commit a31102ab4317a464559d3300097b3051d857d6eb
Author: Cedric BAIL <[email protected]>
Date:   Wed Mar 5 10:41:37 2014 +0900

    eio: factorize code to have one place where data are pushed.
---
 src/lib/eio/eio_dir.c     |  8 +-------
 src/lib/eio/eio_file.c    | 16 ++--------------
 src/lib/eio/eio_main.c    | 15 +++++++++++++++
 src/lib/eio/eio_private.h |  2 ++
 4 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/src/lib/eio/eio_dir.c b/src/lib/eio/eio_dir.c
index 81bc134..2a8889d 100644
--- a/src/lib/eio/eio_dir.c
+++ b/src/lib/eio/eio_dir.c
@@ -700,13 +700,7 @@ _eio_dir_stat_find_forward(Eio_File_Dir_Ls *async,
         async->ls.common.worker.associated = NULL;
      }
 
-   current = ecore_time_get();
-   if (current - async->start > EIO_PACKED_TIME)
-     {
-        async->start = current;
-        ecore_thread_feedback(handler->thread, async->pack);
-        async->pack = NULL;
-     }
+   async->pack = eio_pack_send(handler->thread, async->pack, &async->start);
 
    return filter;
 }
diff --git a/src/lib/eio/eio_file.c b/src/lib/eio/eio_file.c
index c6c79a0..bb221dc 100644
--- a/src/lib/eio/eio_file.c
+++ b/src/lib/eio/eio_file.c
@@ -84,13 +84,7 @@ _eio_file_heavy(void *data, Ecore_Thread *thread)
                }
           }
 
-       current = ecore_time_get();
-       if (current - start > EIO_PACKED_TIME)
-         {
-             start = current;
-             ecore_thread_feedback(thread, pack);
-             pack = NULL;
-          }
+        pack = eio_pack_send(thread, pack, &start);
 
        if (ecore_thread_check(thread))
          break;
@@ -174,13 +168,7 @@ _eio_file_eina_ls_heavy(Ecore_Thread *thread, 
Eio_File_Direct_Ls *async, Eina_It
              async->ls.common.worker.associated = NULL;
          }
 
-        current = ecore_time_get();
-        if (current - start > EIO_PACKED_TIME)
-          {
-             start = current;
-             ecore_thread_feedback(thread, pack);
-             pack = NULL;
-          }
+        pack = eio_pack_send(thread, pack, &start);
 
        if (ecore_thread_check(thread))
          break;
diff --git a/src/lib/eio/eio_main.c b/src/lib/eio/eio_main.c
index a1f9f18..9ff46a7 100644
--- a/src/lib/eio/eio_main.c
+++ b/src/lib/eio/eio_main.c
@@ -181,6 +181,21 @@ eio_associate_free(void *data)
   _eio_pool_free(&associate_pool, tmp);
 }
 
+Eina_List *
+eio_pack_send(Ecore_Thread *thread, Eina_List *pack, double *start)
+{
+   double current;
+
+   current = ecore_time_get();
+   if (current - *start > EIO_PACKED_TIME)
+     {
+        *start = current;
+        ecore_thread_feedback(thread, pack);
+        return NULL;
+     }
+
+   return pack;
+}
 
 /**
  * @endcond
diff --git a/src/lib/eio/eio_private.h b/src/lib/eio/eio_private.h
index b030446..8fd9e7e 100644
--- a/src/lib/eio/eio_private.h
+++ b/src/lib/eio/eio_private.h
@@ -495,4 +495,6 @@ void _eio_monitor_rename(Eio_Monitor *monitor, const char 
*newpath);
 void eio_async_end(void *data, Ecore_Thread *thread);
 void eio_async_error(void *data, Ecore_Thread *thread);
 
+Eina_List *eio_pack_send(Ecore_Thread *thread, Eina_List *pack, double *start);
+
 #endif

-- 


Reply via email to