src/server/webdav/webdav.c

branch
webdav
changeset 227
3c23855f7b46
parent 222
5f05e56cb8e2
child 230
ca50e1ebdc4d
--- a/src/server/webdav/webdav.c	Thu Jan 16 22:28:22 2020 +0100
+++ b/src/server/webdav/webdav.c	Fri Jan 17 17:42:10 2020 +0100
@@ -460,6 +460,32 @@
     return depth;
 }
 
+int webdav_plist_add(
+        pool_handle_t *pool,
+        WebdavPList **begin,
+        WebdavPList **end,
+        WebdavProperty *prop)
+{
+    WebdavPList *elm = pool_malloc(pool, sizeof(WebdavPList));
+    if(!elm) {
+        return 1;
+    }
+    elm->prev = *end;
+    elm->next = NULL;
+    elm->property = prop;
+    
+    if(!*begin) {
+        *begin = elm;
+        *end = elm;
+        return 0;
+    }
+    
+    (*end)->next = elm;
+    *end = elm;
+    
+    return 0;
+}
+
 WebdavPList* webdav_plist_clone(pool_handle_t *pool, WebdavPList *list) {
     WebdavPList *new_list = NULL;     // start of the new list
     WebdavPList *new_list_end = NULL; // end of the new list
@@ -573,44 +599,6 @@
     return 0;
 }
 
-int webdav_property_add_nsdef(
-        WebdavProperty *property, 
-        pool_handle_t *pool,
-        const char *prefix,
-        const char *nsuri)
-{
-    // because we're using a memory pool, we don't free in case stuff in
-    // case of an error (OOM) - stuff will be freed by destroyinig the pool
-    
-    WebdavNSList *new_def = pool_malloc(pool, sizeof(WebdavNSList));
-    if(!new_def) {
-        return 1;
-    }
-    WSNamespace *new_ns = pool_malloc(pool, sizeof(WSNamespace));
-    if(!new_ns) {
-        return 1;
-    }
-    ZERO(new_ns, sizeof(WSNamespace));
-    
-    new_ns->prefix = (xmlChar*)pool_strdup(pool, prefix);
-    new_ns->href = (xmlChar*)pool_strdup(pool, nsuri);
-    if(!new_ns->prefix || !new_ns->href) {
-        return 1;
-    }
-    
-    new_def->namespace = new_ns;
-    new_def->prev = NULL;
-    new_def->next = NULL;
-    
-    if(property->nsdef) {
-        property->nsdef->prev = new_def;
-        new_def->next = property->nsdef;
-    }
-    property->nsdef = new_def;
-    
-    return 0;
-}
-
 WebdavVFSProperties webdav_vfs_properties(
         WebdavPropfindRequest *rq,
         WSBool removefromlist,

mercurial