libidav/methods.c

changeset 818
bc782cca0759
parent 816
839fefbdedc7
child 847
61a3892a8dfb
--- a/libidav/methods.c	Thu May 23 23:19:06 2024 +0200
+++ b/libidav/methods.c	Thu May 23 23:23:36 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