libidav/methods.c

changeset 49
2f71f4ee247a
parent 1
b5bb7b3cd597
--- a/libidav/methods.c	Thu Oct 03 18:52:51 2024 +0200
+++ b/libidav/methods.c	Sun Oct 06 18:18:04 2024 +0200
@@ -75,7 +75,7 @@
     curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, cxBufferWrite);
     curl_easy_setopt(handle, CURLOPT_WRITEDATA, response);
     CxMap *respheaders = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 32);
-    respheaders->simple_destructor = free;
+    cxDefineDestructor(respheaders, free);
     util_capture_header(handle, respheaders);
     
     for(int i=0;i<maxretry;i++) {
@@ -831,25 +831,27 @@
     cxstring s;
     
     CxMap *namespaces = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 8);
-    namespaces->simple_destructor = free;
-    
-    char prefix[8];
-    int pfxnum = 0;
-    if(data->set) {
-        CxIterator i = cxListIterator(data->set);
-        cx_foreach(DavProperty*, p, i) {
-            if(strcmp(p->ns->name, "DAV:")) {
-                snprintf(prefix, 8, "x%d", pfxnum++);
-                cxMapPut(namespaces, cx_hash_key_str(p->ns->name), strdup(prefix));
+    cxDefineDestructor(namespaces, free);
+
+    {
+        char prefix[8];
+        int pfxnum = 0;
+        if (data->set) {
+            CxIterator i = cxListIterator(data->set);
+            cx_foreach(DavProperty*, p, i) {
+                if (strcmp(p->ns->name, "DAV:")) {
+                    snprintf(prefix, 8, "x%d", pfxnum++);
+                    cxMapPut(namespaces, cx_hash_key_str(p->ns->name), strdup(prefix));
+                }
             }
         }
-    }
-    if(data->remove) {
-        CxIterator i = cxListIterator(data->remove);
-        cx_foreach(DavProperty*, p, i) {
-            if(strcmp(p->ns->name, "DAV:")) {
-                snprintf(prefix, 8, "x%d", pfxnum++);
-                cxMapPut(namespaces, cx_hash_key_str(p->ns->name), strdup(prefix));
+        if (data->remove) {
+            CxIterator i = cxListIterator(data->remove);
+            cx_foreach(DavProperty*, p, i) {
+                if (strcmp(p->ns->name, "DAV:")) {
+                    snprintf(prefix, 8, "x%d", pfxnum++);
+                    cxMapPut(namespaces, cx_hash_key_str(p->ns->name), strdup(prefix));
+                }
             }
         }
     }

mercurial