remove unnecessary usage of cx_hash_key_str dav-2 tip

Tue, 30 Dec 2025 21:39:38 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 30 Dec 2025 21:39:38 +0100
branch
dav-2
changeset 893
38800d479cd4
parent 892
02ad5db5ad4d

remove unnecessary usage of cx_hash_key_str

dav/db.c file | annotate | diff | comparison | revisions
dav/main.c file | annotate | diff | comparison | revisions
dav/optparser.c file | annotate | diff | comparison | revisions
dav/scfg.c file | annotate | diff | comparison | revisions
dav/sopt.c file | annotate | diff | comparison | revisions
dav/sync.c file | annotate | diff | comparison | revisions
dav/tags.c file | annotate | diff | comparison | revisions
libidav/davqlexec.c file | annotate | diff | comparison | revisions
libidav/methods.c file | annotate | diff | comparison | revisions
libidav/pwdstore.c file | annotate | diff | comparison | revisions
libidav/resource.c file | annotate | diff | comparison | revisions
libidav/session.c file | annotate | diff | comparison | revisions
libidav/utils.c file | annotate | diff | comparison | revisions
libidav/webdav.c file | annotate | diff | comparison | revisions
--- a/dav/db.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/dav/db.c	Tue Dec 30 21:39:38 2025 +0100
@@ -85,7 +85,7 @@
             if(xstreq(xmlName, "resource")) {
                 LocalResource *res = process_resource(reader);
                 if(res) {
-                    cxMapPut(db->resources, cx_hash_key_str(res->path), res);
+                    cxMapPut(db->resources, res->path, res);
                 } else {
                     error = 1;
                     break;
@@ -93,7 +93,7 @@
             } else if(xstreq(xmlName, "conflict")) {
                 LocalResource *res = process_conflict(reader);
                 if(res) {
-                    cxMapPut(db->conflict, cx_hash_key_str(res->path), res);
+                    cxMapPut(db->conflict, res->path, res);
                 } else {
                     error = 1;
                     break;
@@ -821,7 +821,7 @@
     CxMapIterator i = cxMapIteratorValues(db->resources);
     cx_foreach(LocalResource*, res, i) {
         if(res->hash) {
-            cxMapPut(hmap, cx_hash_key_str(res->hash), res);
+            cxMapPut(hmap, res->hash, res);
         }
     }
     
--- a/dav/main.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/dav/main.c	Tue Dec 30 21:39:38 2025 +0100
@@ -170,7 +170,7 @@
         } else if(!strcasecmp(cmd, "get")) {
             ret = cmd_get(args, FALSE);
         } else if(!strcasecmp(cmd, "cat")) {
-            cxMapPut(args->options, cx_hash_key_str("output"), "-");
+            cxMapPut(args->options, "output", "-");
             ret = cmd_get(args, FALSE);
         } else if(!strcasecmp(cmd, "edit")) {
             ret = cmd_edit(args);
@@ -603,7 +603,7 @@
         return -1;
     }
     if(export) {
-        cxMapPut(a->options, cx_hash_key_str("recursive"), "");
+        cxMapPut(a->options, "recursive", "");
     }
     
     char *url = a->argv[0];
@@ -1148,7 +1148,7 @@
     }
     
     if(import) {
-        cxMapPut(a->options, cx_hash_key_str("resursive"), "");
+        cxMapPut(a->options, "resursive", "");
     }
     
     char *url = a->argv[0];
@@ -2403,7 +2403,7 @@
     CxMap *nsmap = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 16);
     cxSetDestructor(nsmap, free);
     
-    cxMapPut(nsmap, cx_hash_key_str(rootns), strdup("x0"));
+    cxMapPut(nsmap, rootns, strdup("x0"));
     fprintf(out, "%s", "<?xml version=\"1.0\"?>\n");
     fprintf(out, "<x0:%s xmlns:x0=\"%s\">", root, rootns);
     
@@ -2717,7 +2717,7 @@
         if(list) {
             CxIterator iter = cxListIterator(list);
             cx_foreach(PwdIndexEntry*, index, iter) {
-                PwdEntry *e = cxMapGet(secrets->ids, cx_hash_key_str(index->id));
+                PwdEntry *e = cxMapGet(secrets->ids, index->id);
                 if(e) {
                     printf("Id: %s\n", e->id);
                     printf("User: %s\n", e->user);
@@ -2782,7 +2782,7 @@
         return;
     }
     
-    PwdIndexEntry *index = cxMapGet(secrets->index, cx_hash_key_str(id));
+    PwdIndexEntry *index = cxMapGet(secrets->index, id);
     if(!index) {
         return;
     }
@@ -2840,7 +2840,7 @@
         return 1;
     }
     PwdEntry *entry = pwdstore_get(secrets, id);
-    PwdIndexEntry *index = cxMapGet(secrets->index, cx_hash_key_str(id));
+    PwdIndexEntry *index = cxMapGet(secrets->index, id);
     if(!entry || !index) {
         fprintf(stderr, "Credentials with this id doesn't exist.\n");
         return 1;
@@ -3154,7 +3154,7 @@
         }
     } else {
         // url completion
-        cxMapPut(args->options, cx_hash_key_str("noinput"), "");
+        cxMapPut(args->options, "noinput", "");
         
         char *path = NULL;
         DavCfgRepository *repo = dav_config_url2repo(get_config(), url.ptr, &path);
--- a/dav/optparser.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/dav/optparser.c	Tue Dec 30 21:39:38 2025 +0100
@@ -78,7 +78,7 @@
             for(int c=1;c<len;c++) {
                 // argument is in the same arg
                 if(option) {
-                    cxMapPut(a->options, cx_hash_key_str(option), &arg[c]);
+                    cxMapPut(a->options, option, &arg[c]);
                     option = NULL;
                     break;
                 }
@@ -217,5 +217,5 @@
 }
 
 char* cmd_getoption(CmdArgs *arg, const char *name) {
-    return cxMapGet(arg->options, cx_hash_key_str(name));
+    return cxMapGet(arg->options, name);
 }
--- a/dav/scfg.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/dav/scfg.c	Tue Dec 30 21:39:38 2025 +0100
@@ -672,7 +672,7 @@
         dir->trash = NULL;
     }
     
-    cxMapPut(directories, cx_hash_key_str(name), dir);
+    cxMapPut(directories, name, dir);
     
     return 0;
 }
@@ -732,7 +732,7 @@
 }
 
 SyncDirectory* scfg_get_dir(const char *name) {
-    return cxMapGet(directories, cx_hash_key_str(name));
+    return cxMapGet(directories, name);
 }
 
 int scfg_check_dir(SyncDirectory *dir) {
--- a/dav/sopt.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/dav/sopt.c	Tue Dec 30 21:39:38 2025 +0100
@@ -127,5 +127,5 @@
 }
 
 char* cmd_getoption(CmdArgs *arg, const char *name) {
-    return cxMapGet(arg->options, cx_hash_key_str(name));
+    return cxMapGet(arg->options, name);
 }
--- a/dav/sync.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/dav/sync.c	Tue Dec 30 21:39:38 2025 +0100
@@ -665,7 +665,7 @@
 
 static void localres_keep(SyncDatabase *db, const char *path) {
     LocalResource *local = NULL;
-    cxMapRemoveAndGet(db->resources, cx_hash_key_str(path), &local);
+    cxMapRemoveAndGet(db->resources, path, &local);
     if(local) {
         local->keep = TRUE;
     }
@@ -691,7 +691,7 @@
         cxListRemove(stack, 0);
         
         while(res) {
-            cxMapPut(map, cx_hash_key_str(res->path), res);
+            cxMapPut(map, res->path, res);
             
             if(res->children) {
                 cxListInsert(stack, 0, res->children);
@@ -944,7 +944,7 @@
             continue;
         }
         if(!local->keep) {
-            cxMapPut(lres_removed, cx_hash_key_str(local->path), local);
+            cxMapPut(lres_removed, local->path, local);
 
             // TODO: what is the meaning of this code? without overflow the condition is never true
             // if(lres_removed->size > lres_removed->size * 2) {
@@ -969,7 +969,7 @@
     CxMap *conflicts = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, cxListSize(res_conflict)+16);
     i = cxListIterator(res_conflict);
     cx_foreach(DavResource *, res, i) {
-        cxMapPut(conflicts, cx_hash_key_str(res->path), res);
+        cxMapPut(conflicts, res->path, res);
     }
     
     if(SYNC_HASHING(dir)) {
@@ -986,7 +986,7 @@
                 continue;
             }
             
-            LocalResource *local = cxMapGet(hashes, cx_hash_key_str(hash));
+            LocalResource *local = cxMapGet(hashes, hash);
             if(!local) {
                 continue;
             }
@@ -1002,7 +1002,7 @@
             MovedFile *mf = malloc(sizeof(MovedFile));
             mf->content = local;
             mf->resource = res;
-            if(cxMapRemove(lres_removed, cx_hash_key_str(local->path))) {
+            if(cxMapRemove(lres_removed, local->path)) {
                 mf->copy = TRUE;
             } else {
                 mf->copy = FALSE;
@@ -1023,7 +1023,7 @@
         }
         
         DavBool issplit = dav_get_property_ns(mf->resource, DAV_NS, "split") ? 1 : 0;  
-        if(cxMapGet(conflicts, cx_hash_key_str(mf->resource->path))) {
+        if(cxMapGet(conflicts, mf->resource->path)) {
             rename_conflict_file(dir, db, mf->resource->path, issplit);
             sync_conflict++;
         }
@@ -1054,7 +1054,7 @@
             }
             
             DavBool issplit = dav_get_property_ns(res, DAV_NS, "split") ? 1 : 0;  
-            if(cxMapGet(conflicts, cx_hash_key_str(res->path))) {
+            if(cxMapGet(conflicts, res->path)) {
                 rename_conflict_file(dir, db, res->path, issplit);
                 sync_conflict++;
             }
@@ -1113,7 +1113,7 @@
             cxListAdd(rmdirs, removed_res);
         } else if(rmlocal_ret == 0) {
             LocalResource *local = NULL;
-            cxMapRemoveAndGet(db->resources, cx_hash_key_str(removed_res->path), &local);
+            cxMapRemoveAndGet(db->resources, removed_res->path, &local);
             if(local) {
                 local_resource_free(local);
             }
@@ -1130,7 +1130,7 @@
         if(!sync_remove_local_directory(dir, local_dir)) {
             // dir successfully removed, now remove the related db entry
             LocalResource *local = NULL;
-            cxMapRemoveAndGet(db->resources, cx_hash_key_str(local_dir->path), &local);
+            cxMapRemoveAndGet(db->resources, local_dir->path, &local);
             if(local) {
                 local_resource_free(local);
             }
@@ -1384,7 +1384,7 @@
             local = calloc(1, sizeof(LocalResource));
             local->path = strdup(res->path);
             
-            cxMapPut(db->resources, cx_hash_key_str(local->path), local);
+            cxMapPut(db->resources, local->path, local);
         }
         
         // update local res
@@ -1593,7 +1593,7 @@
         // reuse previous LocalResource (content)
         // remove it from db->resources, change path and put it back
         local = NULL;
-        cxMapRemoveAndGet(db->resources, cx_hash_key_str(content->path), &local);
+        cxMapRemoveAndGet(db->resources, content->path, &local);
         if(!local) {
             // can't happen, but handle it nevertheless
             local = content;
@@ -1601,7 +1601,7 @@
         free(content->path);
         local->path = strdup(res->path);
     }
-    cxMapPut(db->resources, cx_hash_key_str(local->path), local);
+    cxMapPut(db->resources, local->path, local);
     
     if(sync_store_metadata(dir, new_path, local, res)) {
         fprintf(stderr, "Cannot store metadata: %s\n", res->path);
@@ -1641,7 +1641,7 @@
     char *link = SYNC_SYMLINK(dir) ?
             dav_get_string_property_ns(res, DAV_PROPS_NS, "link") : NULL;
     
-    LocalResource *local = cxMapGet(db->resources, cx_hash_key_str(path));
+    LocalResource *local = cxMapGet(db->resources, path);
     
     char *local_path;
     if(link) {
@@ -1768,7 +1768,7 @@
             // new local resource
             local = calloc(1, sizeof(LocalResource));
             local->path = strdup(path);
-            cxMapPut(db->resources, cx_hash_key_str(local->path), local);
+            cxMapPut(db->resources, local->path, local);
         }
         
         if(sync_store_metadata(dir, local_path, local, res)) {
@@ -1857,11 +1857,11 @@
     }
       
     // if it doesn't exist in the db, create an entry for the dir
-    LocalResource *local = cxMapGet(db->resources, cx_hash_key(res_path.ptr, res_path.length));
+    LocalResource *local = cxMapGet(db->resources, res_path);
     if(!local) {
         local = calloc(1, sizeof(LocalResource));
         local->path = cx_strdup(res_path).ptr;
-        cxMapPut(db->resources, cx_hash_key_str(local->path), local);
+        cxMapPut(db->resources, local->path, local);
     }
     local->isdirectory = 1;
     
@@ -1983,7 +1983,7 @@
                     LocalResource *conflict = calloc(1, sizeof(LocalResource));
                     conflict->path = strdup(new_res_path.ptr);
                     conflict->conflict_source = strdup(path);
-                    cxMapPut(db->conflict, cx_hash_key_str(new_res_path.ptr), conflict);
+                    cxMapPut(db->conflict, new_res_path.ptr, conflict);
                 }
             }
         }
@@ -2058,7 +2058,7 @@
 }
 
 static int res_isconflict(SyncDatabase *db, LocalResource *res) {
-    return cxMapGet(db->conflict, cx_hash_key_str(res->path)) ? 1 : 0;
+    return cxMapGet(db->conflict, res->path) ? 1 : 0;
 }
 
 int cmd_push(CmdArgs *a, DavBool outgoing, DavBool archive) {
@@ -2220,14 +2220,14 @@
         
        
         // we need a fast file lookup map later to detect deleted files
-        cxMapPut(resources_map, cx_hash_key_str(local_res->path), local_res);
+        cxMapPut(resources_map, local_res->path, local_res);
         
         // dynamic tag filter
         if(!localres_matches_tags(dir, local_res, tagfilter)) {
             if(!remove_file) {
                 LocalResource *dbres = cxMapGet(
                         db->resources,
-                        cx_hash_key_str(local_res->path));
+                        local_res->path);
                 if(dbres) {
                     // this makes sure the file will not be deleted later
                     dbres->keep = TRUE;
@@ -2283,18 +2283,18 @@
             char *hash = util_file_hash(local_path);
             local->hash = hash;
             // check if a file with this hash already exists
-            LocalResource *origin = cxMapGet(db_hashes, cx_hash_key_str(hash));
+            LocalResource *origin = cxMapGet(db_hashes, hash);
             if(origin) {
                 local->origin = local_resource_copy(origin, origin->path);
                 // the file is a copied/moved file
                 // check if the file is in the resources_map, because then
                 // it still exists
-                if(cxMapGet(resources_map, cx_hash_key_str(origin->path))) {
+                if(cxMapGet(resources_map, origin->path)) {
                     cxListAdd(ls_copy, local);
                 } else {
                     cxListAdd(ls_move, local);
                     // put file in resources_map to prevent deletion
-                    cxMapPut(resources_map, cx_hash_key_str(origin->path), local);
+                    cxMapPut(resources_map, origin->path, local);
                 }
                 // remove list elemend from ls_new
                 cxIteratorFlagRemoval(mut_iter);
@@ -2414,8 +2414,8 @@
             // remove old db entry (if it exists)
             // and add add new entry
             // TODO: free??
-            LocalResource *dbres = cxMapGet(db->resources, cx_hash_key_str(local_res->path));
-            cxMapPut(db->resources, cx_hash_key_str(local_res->path), local_res);
+            LocalResource *dbres = cxMapGet(db->resources, local_res->path);
+            cxMapPut(db->resources, local_res->path, local_res);
         }
         
         dav_resource_free(res);
@@ -2475,8 +2475,8 @@
                 ret = -1;
                 error = 1;
             } else {
-                LocalResource *dbres = cxMapGet(db->resources, cx_hash_key_str(local->path));
-                cxMapPut(db->resources, cx_hash_key_str(local->path), local);
+                LocalResource *dbres = cxMapGet(db->resources, local->path);
+                cxMapPut(db->resources, local->path, local);
             }
         }
         copy = FALSE;
@@ -2552,11 +2552,11 @@
 
                 if(!err) {
                     LocalResource *dbres = NULL;
-                    cxMapRemoveAndGet(db->resources, cx_hash_key_str(local_res->path), &dbres);
+                    cxMapRemoveAndGet(db->resources, local_res->path, &dbres);
                     // in case of a conflict, don't store the resource
                     // in the db, if it is new
                     if(!res_conflict || dbres) {
-                        cxMapPut(db->resources, cx_hash_key_str(local_res->path), local_res);
+                        cxMapPut(db->resources, local_res->path, local_res);
                     }
                 }
             }
@@ -2577,9 +2577,9 @@
         if(local_res->metadata_updated) {
             log_printf("update: %s\n", local_res->path);
             if(!sync_update_metadata(dir, sn, res, local_res)) {
-                LocalResource *dbres = cxMapGet(db->resources, cx_hash_key_str(local_res->path));
+                LocalResource *dbres = cxMapGet(db->resources, local_res->path);
                 if(dbres != local_res) {
-                    cxMapPut(db->resources, cx_hash_key_str(local_res->path), local_res);
+                    cxMapPut(db->resources, local_res->path, local_res);
                 }
             }
         }
@@ -2613,7 +2613,7 @@
                 }
             } else {
                 LocalResource *dbres = NULL;
-                cxMapRemoveAndGet(db->resources, cx_hash_key_str(local->path), &dbres);
+                cxMapRemoveAndGet(db->resources, local->path, &dbres);
                 //local_resource_free(dbres);
             }
         }
@@ -2711,7 +2711,7 @@
                 }
             }
             
-            cxMapPut(files, cx_hash_key_str(f.path), &nres);
+            cxMapPut(files, f.path, &nres);
         }
         dir = sd;
     }
@@ -2886,7 +2886,7 @@
                         log_error("sync_get_resource failed for resource: %s\n", res->path);
                         sync_error++;
                     } else if(!update_local_entry) {
-                        LocalResource *lr = cxMapGet(db->resources, cx_hash_key_str(res->path));
+                        LocalResource *lr = cxMapGet(db->resources, res->path);
                         if(lr) {
                             lr->last_modified = 0;
                             nullfree(lr->hash);
@@ -3227,7 +3227,7 @@
         DavBool restore_removed,
         DavBool restore_modified)
 {
-    LocalResource *db_res = cxMapGet(db->resources, cx_hash_key_str(res->path));
+    LocalResource *db_res = cxMapGet(db->resources, res->path);
     res->tags_updated = 0;
     if(db_res) { 
         // copy some metadata from db_res, that localscan does not deliver
@@ -3260,7 +3260,7 @@
         
         // check if the file must be restored on the server
         if(svrres) {
-            DavResource *remote = cxMapGet(svrres, cx_hash_key_str(res->path));
+            DavResource *remote = cxMapGet(svrres, res->path);
             if(restore_removed && !remote) {
                 return 1;
             }
@@ -3698,7 +3698,7 @@
         current_xattr = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, nelm + 8);
         for(int i=0;i<nelm;i++) {
             // use the xattr name as key and store any value
-            cxMapPut(current_xattr, cx_hash_key_str(list[i]), list[i]);
+            cxMapPut(current_xattr, list[i], list[i]);
         }
     }
     if(list) {
@@ -3721,7 +3721,7 @@
             // attributes from the map and all remaining attributes must
             // be removed with xattr_remove
             char *removed_value = NULL;
-            cxMapRemoveAndGet(current_xattr, cx_hash_key_str(xattr->names[i]), &removed_value);
+            cxMapRemoveAndGet(current_xattr, xattr->names[i], &removed_value);
             if(removed_value) {
                 free(removed_value);
             }
@@ -4270,7 +4270,7 @@
                 FilePart *f = calloc(1, sizeof(FilePart));
                 f->block = blockindex;
                 f->hash = block_hash;
-                cxMapPut(updated_parts_map, cx_hash_key_str(name), f);
+                cxMapPut(updated_parts_map, name, f);
             }
             dav_resource_free(part);
             uploaded_parts++;
@@ -4310,7 +4310,7 @@
     DavResource *part = parts->children;
     while(part) {
         FilePart *fp = NULL;
-        cxMapRemoveAndGet(updated_parts_map, cx_hash_key_str(part->name), &fp);
+        cxMapRemoveAndGet(updated_parts_map, part->name, &fp);
         // every part we uploaded is in the map
         // if we get parts that are not in the map, someone else uploaded it
         if(fp) {
@@ -4604,7 +4604,7 @@
     
     LocalResource *local_origin = local->origin;
     if(!copy) {
-        cxMapRemove(db->resources, cx_hash_key_str(local_origin->path));
+        cxMapRemove(db->resources, local_origin->path);
     }
     
     // set resource metadata
@@ -4872,7 +4872,7 @@
     }
     
     for(int i=0;i<numdc;i++) {
-        cxMapRemove(db->conflict, cx_hash_key_str(dc[i]));
+        cxMapRemove(db->conflict, dc[i]);
     }
     
     free(dc);
@@ -5377,7 +5377,7 @@
     }
     
     LocalResource *newres = NULL;
-    LocalResource *localres = cxMapGet(db->resources, cx_hash_key_str(file.path));
+    LocalResource *localres = cxMapGet(db->resources, file.path);
     if(!localres) {
         newres = calloc(1, sizeof(LocalResource));
         newres->path = strdup(file.path);
--- a/dav/tags.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/dav/tags.c	Tue Dec 30 21:39:38 2025 +0100
@@ -389,7 +389,7 @@
     int i = 0;
     CxIterator iter = cxListIterator(tags2);
     cx_foreach(DavTag*, t, iter) {
-        if(!cxMapGet(map1, cx_hash_key_str(t->name))) {
+        if(!cxMapGet(map1, t->name)) {
             equal = 0;
             break;
         }
@@ -437,7 +437,7 @@
     if(tags2) {
         CxIterator iter = cxListIterator(tags2);
         cx_foreach(DavTag*, t, iter) {
-            if(!cxMapGet(tag_map, cx_hash_key_str(t->name))) {
+            if(!cxMapGet(tag_map, t->name)) {
                 DavTag *newt = calloc(1, sizeof(DavTag));
                 newt->color = t->color ? strdup(t->color) : NULL;
                 newt->name = strdup(t->name);
@@ -457,7 +457,7 @@
     CxIterator i = cxListIterator(colored);
     cx_foreach(DavTag*, colored_tag, i) {
         if(colored_tag->color) {
-            DavTag *tag = cxMapGet(tagmap, cx_hash_key_str(colored_tag->name));
+            DavTag *tag = cxMapGet(tagmap, colored_tag->name);
             if(tag && !tag->color) {
                 tag->color = strdup(colored_tag->color);
             }
@@ -652,7 +652,7 @@
     CxMap *tagmap = taglist2map(dav_tags);
     CxIterator i = cxListIterator(tags);
     cx_foreach(DavTag *, tag, i) {
-        if (cxMapGet(tagmap, cx_hash_key_str(tag->name)) == NULL) {
+        if (cxMapGet(tagmap, tag->name) == NULL) {
             ret = 0;
             break;
         }
@@ -667,7 +667,7 @@
     CxMap *tagmap = taglist2map(dav_tags);
     CxIterator i = cxListIterator(tags);
     cx_foreach(DavTag *, tag, i) {
-        if (cxMapGet(tagmap, cx_hash_key_str(tag->name))) {
+        if (cxMapGet(tagmap, tag->name)) {
             ret = 1;
             break;
         }
@@ -681,7 +681,7 @@
     CxMap *tagmap = taglist2map(dav_tags);
     CxIterator i = cxListIterator(tags);
     cx_foreach(DavTag *, tag, i) {
-        if (cxMapGet(tagmap, cx_hash_key_str(tag->name))) {
+        if (cxMapGet(tagmap, tag->name)) {
             if (matches_exactly_one) {
                 cxMapFree(tagmap);
                 return 0;
--- a/libidav/davqlexec.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/libidav/davqlexec.c	Tue Dec 30 21:39:38 2025 +0100
@@ -262,7 +262,7 @@
         property->name = name;
         property->value = NULL;
         
-        cxMapPut(map, cx_hash_key(expression->srctext.ptr, expression->srctext.length), property);
+        cxMapPut(map, expression->srctext, property);
     }
     
     if(expression->left) {
--- a/libidav/methods.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/libidav/methods.c	Tue Dec 30 21:39:38 2025 +0100
@@ -103,7 +103,7 @@
          *    => the server handled our request and we can stop requesting
          */
         char *msdavexterror;
-        msdavexterror = cxMapGet(respheaders, cx_hash_key_str("x-msdavext_error"));
+        msdavexterror = cxMapGet(respheaders, "x-msdavext_error");
         int iishack =  depth == 1 &&
             msdavexterror && !strncmp(msdavexterror, "589831;", 7);
         
@@ -166,7 +166,7 @@
         CxIterator i = cxListIterator(properties);
         cx_foreach(DavProperty*, p, i) {
             if(strcmp(p->ns->name, "DAV:")) {
-                cxMapPut(namespaces, cx_hash_key_str(p->ns->prefix), p->ns);
+                cxMapPut(namespaces, p->ns->prefix, p->ns);
             }
 
             // if the properties list contains the idav properties crypto-name
@@ -190,7 +190,7 @@
     if(add_crypto_name && add_crypto_key && DAV_CRYPTO(sn) && !nocrypt) {
         idav_ns.prefix = "idav";
         idav_ns.name = DAV_NS;
-        cxMapPut(namespaces, cx_hash_key_str("idav"), &idav_ns);
+        cxMapPut(namespaces, "idav", &idav_ns);
     }
     
     cxBufferPutString(buf, "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n");
@@ -804,7 +804,7 @@
             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));
+                    cxMapPut(namespaces, p->ns->name, strdup(prefix));
                 }
             }
         }
@@ -813,7 +813,7 @@
             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));
+                    cxMapPut(namespaces, p->ns->name, strdup(prefix));
                 }
             }
         }
@@ -837,7 +837,7 @@
         cxBufferPutString(buf, "<D:set>\n<D:prop>\n");
         CxIterator i = cxListIterator(data->set);
         cx_foreach(DavProperty*, property, i) {
-            char *prefix = cxMapGet(namespaces, cx_hash_key_str(property->ns->name));
+            char *prefix = cxMapGet(namespaces, property->ns->name);
             if(!prefix) {
                 prefix = "D";
             }
@@ -870,7 +870,7 @@
         cxBufferPutString(buf, "<D:remove>\n<D:prop>\n");
         CxIterator i = cxListIterator(data->remove);
         cx_foreach(DavProperty*, property, i) {
-            char *prefix = cxMapGet(namespaces, cx_hash_key_str(property->ns->name));
+            char *prefix = cxMapGet(namespaces, property->ns->name);
             
             cxBufferPutString(buf, "<");
             cxBufferPutString(buf, prefix);
--- a/libidav/pwdstore.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/libidav/pwdstore.c	Tue Dec 30 21:39:38 2025 +0100
@@ -411,11 +411,11 @@
 }
 
 int pwdstore_has_id(PwdStore *s, const char *id) {
-    return cxMapGet(s->index, cx_hash_key_str(id)) ? 1 : 0;
+    return cxMapGet(s->index, id) ? 1 : 0;
 }
 
 PwdEntry* pwdstore_get(PwdStore *p, const char *id) {
-    PwdEntry *e = cxMapGet(p->ids, cx_hash_key_str(id));
+    PwdEntry *e = cxMapGet(p->ids, id);
     if(e && e->user && e->password) {
         return e;
     } else {
@@ -428,11 +428,11 @@
     entry->id = strdup(id);
     entry->user = strdup(username);
     entry->password = strdup(password);
-    cxMapPut(p->ids, cx_hash_key_str(id), entry);
+    cxMapPut(p->ids, id, entry);
 }
 
 void pwdstore_put_index(PwdStore *p, char *id, CxList *locations) {
-    PwdIndexEntry *e = cxMapGet(p->index, cx_hash_key_str(id));
+    PwdIndexEntry *e = cxMapGet(p->index, id);
     if(e) {
         return;
     }
@@ -445,7 +445,7 @@
         newentry->locations = NULL;
         cxListAdd(p->noloc, newentry);
     }
-    cxMapPut(p->index, cx_hash_key_str(id), newentry);
+    cxMapPut(p->index, id, newentry);
 }
 
 void write_index_entry(CxBuffer *out, PwdIndexEntry *e) {
--- a/libidav/resource.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/libidav/resource.c	Tue Dec 30 21:39:38 2025 +0100
@@ -1508,7 +1508,7 @@
     // create an xml document containing all properties
     CxMap *nsmap = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 8);
     cxSetDestructor(nsmap, free);
-    cxMapPut(nsmap, cx_hash_key_str("DAV:"), strdup("D"));
+    cxMapPut(nsmap, "DAV:", strdup("D"));
     
     cxBufferPutString(content, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
     cxBufferPutString(content, "<D:prop xmlns:D=\"DAV:\">\n");
--- a/libidav/session.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/libidav/session.c	Tue Dec 30 21:39:38 2025 +0100
@@ -405,7 +405,7 @@
         char *cp = strdup(path);
         //printf("cp: %s\n", cp);
         while(strlen(cp) > 1) {
-            char *cached = cxMapGet(sn->pathcache, cx_hash_key_str(cp));
+            char *cached = cxMapGet(sn->pathcache, cp);
             if(cached) {
                 start = strlen(cp);
                 begin = start;
@@ -621,7 +621,7 @@
     
     cxstring p = cx_str(path);
     
-    DavLock *lock = cxMapGet(locks->resource_locks, cx_hash_key(p.ptr, p.length));
+    DavLock *lock = cxMapGet(locks->resource_locks, p);
     if(lock) {
         return lock;
     }
@@ -647,7 +647,7 @@
         return;
     }
     
-    if(!cxMapRemove(locks->resource_locks, cx_hash_key_str(path))) {
+    if(!cxMapRemove(locks->resource_locks, path)) {
         return;
     }
 
--- a/libidav/utils.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/libidav/utils.c	Tue Dec 30 21:39:38 2025 +0100
@@ -460,7 +460,7 @@
     }
     cxmutstr value_cp = cx_strdup(cx_strtrim(value));
         
-    cxMapPut(map, cx_hash_key(key_cp.ptr, key_cp.length), value_cp.ptr);
+    cxMapPut(map, key_cp, value_cp.ptr);
     
     free(key_cp.ptr);
     
--- a/libidav/webdav.c	Tue Dec 30 21:27:14 2025 +0100
+++ b/libidav/webdav.c	Tue Dec 30 21:39:38 2025 +0100
@@ -249,14 +249,14 @@
 
 DavNamespace* dav_get_namespace(DavContext *context, const char *prefix) {
     dav_context_lock(context);
-    DavNamespace *ns = cxMapGet(context->namespaces, cx_hash_key_str(prefix));
+    DavNamespace *ns = cxMapGet(context->namespaces, prefix);
     dav_context_unlock(context);
     return ns;
 }
 
 DavNamespace* dav_get_namespace_s(DavContext *context, cxstring prefix) {
     dav_context_lock(context);
-    DavNamespace *ns = cxMapGet(context->namespaces, cx_hash_key(prefix.ptr, prefix.length));
+    DavNamespace *ns = cxMapGet(context->namespaces, prefix);
     dav_context_unlock(context);
     return ns;
 }

mercurial