This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch desktop-restore
in repository terminology.

View the commit online.

commit 6cff1f2e03c0d5669406a533f98bb9b5e33a597c
Author: [email protected] <[email protected]>
AuthorDate: Fri Mar 20 20:32:43 2026 -0600

    refactor: migrate session.c from ecore_file to eina equivalents
    
    Replace ecore_file functions with their eina synchronous equivalents to
    reduce unnecessary ecore dependency in session management. The migration
    improves consistency with eina's iterator-based APIs:
    
    - ecore_file_ls() → eina_file_ls() (returns full paths via iterator)
    - ecore_file_unlink() → eina_file_unlink() (6 call sites)
    - ecore_file_exists() → access(path, F_OK) (direct POSIX call)
    
    Functions kept as-is (no eina sync equivalent): ecore_file_is_dir,
    ecore_file_mv, ecore_file_mkpath.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---
 src/bin/session.c | 92 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 47 insertions(+), 45 deletions(-)

diff --git a/src/bin/session.c b/src/bin/session.c
index cf18e2eb..0cfe0846 100644
--- a/src/bin/session.c
+++ b/src/bin/session.c
@@ -623,21 +623,21 @@ session_save(const char *name, Win *wn)
      {
         ERR("session_save: eet_data_write failed");
         eet_close(ef);
-        ecore_file_unlink(tmp);
+        eina_file_unlink(tmp);
         goto cleanup;
      }
 
    if (eet_close(ef) != EET_ERROR_NONE)
      {
         ERR("session_save: eet_close failed");
-        ecore_file_unlink(tmp);
+        eina_file_unlink(tmp);
         goto cleanup;
      }
 
    if (!ecore_file_mv(tmp, path))
      {
         ERR("session_save: rename '%s' -> '%s' failed", tmp, path);
-        ecore_file_unlink(tmp);
+        eina_file_unlink(tmp);
         goto cleanup;
      }
 
@@ -1179,7 +1179,7 @@ _session_is_locked(const char *name)
      {
         fclose(fp);
         /* Corrupt lock — treat as stale */
-        ecore_file_unlink(path);
+        eina_file_unlink(path);
         return EINA_FALSE;
      }
    fclose(fp);
@@ -1201,7 +1201,7 @@ _session_is_locked(const char *name)
 
    /* Process is dead — stale lock */
    INF("session '%s': removing stale lock (pid %d)", name, (int)pid);
-   ecore_file_unlink(path);
+   eina_file_unlink(path);
    return EINA_FALSE;
 }
 
@@ -1238,7 +1238,7 @@ _session_unlock(const char *name)
    if (!_session_lock_path_get(name, path, sizeof(path)))
      return;
 
-   ecore_file_unlink(path);
+   eina_file_unlink(path);
 
    EINA_LIST_FOREACH(_locked_sessions, l, s)
      {
@@ -1260,7 +1260,7 @@ _session_unlock_all(void)
    EINA_LIST_FREE(_locked_sessions, name)
      {
         if (_session_lock_path_get(name, path, sizeof(path)))
-          ecore_file_unlink(path);
+          eina_file_unlink(path);
         eina_stringshare_del(name);
      }
    _locked_sessions = NULL;
@@ -1304,8 +1304,8 @@ static void
 _meta_cache_build(void)
 {
    char dir[PATH_MAX];
-   Eina_List *files;
-   char *file;
+   Eina_Iterator *it;
+   const char *path;
 
    _meta_cache_free();
 
@@ -1323,49 +1323,47 @@ _meta_cache_build(void)
         return;
      }
 
-   files = ecore_file_ls(dir);
-   EINA_LIST_FREE(files, file)
+   it = eina_file_ls(dir);
+   EINA_ITERATOR_FOREACH(it, path)
      {
+        const char *slash = strrchr(path, '/');
+        const char *file = slash ? slash + 1 : path;
         size_t len = strlen(file);
         if (len > 4 && !strcmp(file + len - 4, ".ses"))
           {
-             char path[PATH_MAX];
-             int pn = snprintf(path, sizeof(path), "%s/%s", dir, file);
-             if (pn >= 0 && (size_t)pn < sizeof(path))
+             Eet_File *ef = eet_open(path, EET_FILE_MODE_READ);
+             if (ef)
                {
-                  Eet_File *ef = eet_open(path, EET_FILE_MODE_READ);
-                  if (ef)
+                  Session_File *sf = eet_data_read(ef, _edd_file,
+                                                   "session");
+                  if (sf)
                     {
-                       Session_File *sf = eet_data_read(ef, _edd_file,
-                                                        "session");
-                       if (sf)
+                       Session_Meta *m = calloc(1, sizeof(*m));
+                       if (m)
                          {
-                            Session_Meta *m = calloc(1, sizeof(*m));
-                            if (m)
+                            char *name = strndup(file, len - 4);
+                            if (name)
                               {
-                                 char *name = strndup(file, len - 4);
-                                 if (name)
-                                   {
-                                      m->name = eina_stringshare_add(name);
-                                      free(name);
-                                   }
-                                 if (!m->name)
-                                   {
-                                      free(m);
-                                   }
-                                 else
-                                   {
-                                      _meta_cache = eina_list_append(_meta_cache, m);
-                                   }
+                                 m->name = eina_stringshare_add(name);
+                                 free(name);
+                              }
+                            if (!m->name)
+                              {
+                                 free(m);
+                              }
+                            else
+                              {
+                                 _meta_cache = eina_list_append(_meta_cache, m);
                               }
-                            _session_file_free(sf);
                          }
-                       eet_close(ef);
+                       _session_file_free(sf);
                     }
+                  eet_close(ef);
                }
           }
-        free(file);
+        eina_stringshare_del(path);
      }
+   eina_iterator_free(it);
 
    _meta_cache_valid = EINA_TRUE;
 }
@@ -1380,8 +1378,9 @@ Eina_List *
 session_list(void)
 {
    char dir[PATH_MAX];
-   Eina_List *files, *result = NULL;
-   char *file;
+   Eina_List *result = NULL;
+   Eina_Iterator *it;
+   const char *path;
 
    int n = snprintf(dir, sizeof(dir), "%s/terminology/sessions",
                     _session_dir_get());
@@ -1391,9 +1390,11 @@ session_list(void)
    if (!ecore_file_is_dir(dir))
      return NULL;
 
-   files = ecore_file_ls(dir);
-   EINA_LIST_FREE(files, file)
+   it = eina_file_ls(dir);
+   EINA_ITERATOR_FOREACH(it, path)
      {
+        const char *slash = strrchr(path, '/');
+        const char *file = slash ? slash + 1 : path;
         size_t len = strlen(file);
         if (len > 4 && !strcmp(file + len - 4, ".ses"))
           {
@@ -1405,8 +1406,9 @@ session_list(void)
                   free(name);
                }
           }
-        free(file);
+        eina_stringshare_del(path);
      }
+   eina_iterator_free(it);
    return result;
 }
 
@@ -1481,12 +1483,12 @@ session_del(const char *name)
      }
    if (!_session_path_get(name, path, sizeof(path)))
      return EINA_FALSE;
-   if (!ecore_file_exists(path))
+   if (access(path, F_OK) != 0)
      {
         ERR("session_del: file not found: %s", path);
         return EINA_FALSE;
      }
-   if (!ecore_file_unlink(path))
+   if (!eina_file_unlink(path))
      {
         ERR("session_del: failed to delete: %s", path);
         return EINA_FALSE;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to