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

git pushed a commit to branch master
in repository efm2.

View the commit online.

commit c21beaa026ef3a0123ca4318424b29d37fce47b3
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Fri Aug 1 12:59:26 2025 +0100

    meta - fix null data to actuallty delete
---
 src/backends/default/meta.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/backends/default/meta.c b/src/backends/default/meta.c
index 8fd1e50..37138f1 100644
--- a/src/backends/default/meta.c
+++ b/src/backends/default/meta.c
@@ -151,7 +151,7 @@ static void
 _meta_file_write(Meta_File *mf)
 { // write out all in memory metadata to target meta file
   Util_Modtime  mt, mt2;
-  Eina_List    *l;
+  Eina_List    *l, *ll;
   Meta         *m;
   FILE         *f = NULL;
   char         *meta_path = NULL, *meta_path_tmp = NULL, *dir = NULL;
@@ -168,15 +168,26 @@ _meta_file_write(Meta_File *mf)
   free(dir);
   dir = NULL;
 
+  // walk meta for file and remove null entries as we don't want to write
+  // any out and unlink/del meta file if empty
+  EINA_LIST_FOREACH_SAFE(mf->list, l, ll, m)
+  {
+    if (!m->data)
+      {
+        eina_stringshare_del(m->meta);
+        free(m);
+        mf->list = eina_list_remove_list(mf->list, l);
+      }
+  }
   if (mf->list)
     {
 merge_again:
       // get the mod time of the target file
       mt = util_file_modtime_get(meta_path);
       // has the target file changed since we may have read from it?
-      if (((util_modtime_valid(mt))
-            && (util_modtime_valid(mf->modtime))
-            && (util_modtime_cmp(mt, mf->modtime) >= 0)) || (!util_modtime_valid(mf->modtime)))
+      if (((util_modtime_valid(mt)) && (util_modtime_valid(mf->modtime))
+           && (util_modtime_cmp(mt, mf->modtime) >= 0))
+          || (!util_modtime_valid(mf->modtime)))
         { // file we are about to write is newer than original. we need to
           // merge these files - keep changed keys but re-load rest. if we've
           // picked up keys from a file + personal overlay file then we
@@ -207,13 +218,13 @@ merge_again:
           meta_path = NULL;
           free(meta_path_tmp);
           meta_path_tmp = NULL;
-          meta_path = _meta_personal_overlay_file_get(mf);
+          meta_path     = _meta_personal_overlay_file_get(mf);
           if (!meta_path) goto err;
           dir = ecore_file_dir_get(meta_path);
           if (!dir) goto err;
           if (!ecore_file_is_dir(dir)) ecore_file_mkpath(dir);
           free(dir);
-          dir = NULL;
+          dir           = NULL;
           meta_path_tmp = malloc(strlen(meta_path) + 7 + 1);
           // XXX: malloc fails?
           strcpy(meta_path_tmp, meta_path);
@@ -483,7 +494,7 @@ meta_set(const char *path, const char *meta, const char *data)
   {
     if (!strcmp(m->meta, meta))
       { // found matching meta key -> modify or del it
-        if (!strcmp(m->data, data)) return;
+        if ((data) && (!strcmp(m->data, data))) return;
         // replaces data - if data is NULL it's deleted so keep entry
         eina_stringshare_replace(&m->data, data);
         m->changed = EINA_TRUE;

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

Reply via email to