src/server/webdav/xattrbackend.c

changeset 579
e10457d74fe1
parent 490
d218607f5a7e
--- a/src/server/webdav/xattrbackend.c	Mon Feb 10 17:44:51 2025 +0100
+++ b/src/server/webdav/xattrbackend.c	Sun Mar 02 18:10:52 2025 +0100
@@ -240,7 +240,7 @@
         CxAllocator *a,
         CxMap *pmap)
 {
-    CxIterator i = cxMapIteratorValues(pmap);
+    CxMapIterator i = cxMapIteratorValues(pmap);
     cx_foreach(WebdavProperty*, prop, i) {
         if(request->propname) {
             prop->vtype = WS_VALUE_NO_TYPE;
@@ -322,10 +322,11 @@
                 (const char*)prop->namespace->href,
                 (const char*)prop->name);
         if(!key.data) {
-            cxMapDestroy(pmap);
+            cxMapFree(pmap);
             return 1;
         }
-        void *rmprop = cxMapRemoveAndGet(pmap, key);
+        void *rmprop = NULL;
+        cxMapRemoveAndGet(pmap, key, &rmprop);
         cxFree(a, (void*)key.data);
         
         // TODO: free rmprop
@@ -345,7 +346,7 @@
         }
         
         if(webdav_xattr_put_prop(pmap, prop)) {
-            cxMapDestroy(pmap);
+            cxMapFree(pmap);
             return 1;
         }
         
@@ -506,14 +507,14 @@
 
 int webdav_xattr_put_prop(CxMap *pmap, WebdavProperty *prop) {
     CxHashKey key = webdav_property_key_a(
-            pmap->allocator,
+            pmap->collection.allocator,
             (const char*)prop->namespace->href,
             (const char*)prop->name);
     if(!key.data) {
         return 1;
     }
     int ret = cxMapPut(pmap, key, prop);
-    cxFree(pmap->allocator, (void*)key.data);
+    cxFree(pmap->collection.allocator, (void*)key.data);
     return ret;
 }
 
@@ -698,7 +699,7 @@
     
     if(error) {
         // TODO: free pmap content
-        cxMapDestroy(pmap);
+        cxMapFree(pmap);
         pmap = NULL;
     }
     
@@ -713,7 +714,7 @@
         return (cxmutstr){NULL,0};
     }
     
-    CxIterator i = cxMapIteratorValues(pmap);
+    CxMapIterator i = cxMapIteratorValues(pmap);
     cx_foreach(WebdavProperty*, prop, i) {
         WSXmlData *property_value = NULL;
         if(prop->vtype == WS_VALUE_XML_NODE) {

mercurial