libidav/resource.c

branch
dav-2
changeset 882
86e61b4ef708
parent 881
64989511f6c3
child 886
da79af4baec8
--- a/libidav/resource.c	Mon Sep 08 11:39:54 2025 +0200
+++ b/libidav/resource.c	Mon Sep 08 12:10:13 2025 +0200
@@ -281,6 +281,18 @@
     return resource->href;
 }
 
+CxHashKey dav_resource_path_key(DavResource *res) {
+    CxHashKey key = { NULL, 0, 0 };
+    if(res && res->path) {
+        cxstring res_path = cx_str(res->path);
+        if(res_path.length > 0 && res_path.ptr[res_path.length-1] == '/') {
+            res_path.length--;
+        }
+        key = cx_hash_key(res_path.ptr, res_path.length);
+    }
+    return key;
+}
+
 CxTreeIterator dav_resource_iterator(DavResource *res) {
     return cx_tree_iterator(res, FALSE, offsetof(DavResource, children), offsetof(DavResource, next));
 }

mercurial