src/server/webdav/xattrbackend.c

changeset 490
d218607f5a7e
parent 484
c036a8b242a8
--- a/src/server/webdav/xattrbackend.c	Sat Mar 25 17:18:51 2023 +0100
+++ b/src/server/webdav/xattrbackend.c	Fri May 05 18:02:11 2023 +0200
@@ -219,7 +219,7 @@
                 a,
                 (const char*)reqprop->namespace->href,
                 (const char*)reqprop->name);
-        if(!key.data.str) {
+        if(!key.data) {
             return 1;
         }
         
@@ -299,7 +299,7 @@
         pool_free(sn->pool, xattr_data);
     } else {
         // empty map
-        pmap = cxHashMapCreate(a, request->setcount + 8);
+        pmap = cxHashMapCreate(a, CX_STORE_POINTERS, request->setcount + 8);
     }
     if(!pmap) {
         return 1;
@@ -321,12 +321,12 @@
                 a,
                 (const char*)prop->namespace->href,
                 (const char*)prop->name);
-        if(!key.data.str) {
+        if(!key.data) {
             cxMapDestroy(pmap);
             return 1;
         }
-        void *rmprop = cxMapRemove(pmap, key);
-        cxFree(a, key.data.str);
+        void *rmprop = cxMapRemoveAndGet(pmap, key);
+        cxFree(a, (void*)key.data);
         
         // TODO: free rmprop
         
@@ -509,16 +509,16 @@
             pmap->allocator,
             (const char*)prop->namespace->href,
             (const char*)prop->name);
-    if(!key.data.str) {
+    if(!key.data) {
         return 1;
     }
     int ret = cxMapPut(pmap, key, prop);
-    cxFree(pmap->allocator, key.data.str);
+    cxFree(pmap->allocator, (void*)key.data);
     return ret;
 }
 
 CxMap* webdav_xattr_parse_data(CxAllocator *a, const char *data, size_t len, const char *path) {
-    CxMap *pmap = cxHashMapCreate(a, 32);
+    CxMap *pmap = cxHashMapCreate(a, CX_STORE_POINTERS, 32);
     if(!pmap) {
         return NULL;
     }

mercurial