Tue, 30 Dec 2025 21:44:49 +0100
remove unnecessary usage of cx_hash_key_str
--- a/src/server/config/mimeconf.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/config/mimeconf.c Tue Dec 30 21:44:49 2025 +0100 @@ -67,7 +67,7 @@ } void free_mime_config(MimeConfig *conf) { - cxMempoolFree(conf->parser.a->data); // TODO: is there a better way to access the mempool? + cxMempoolFree(conf->parser.mp); free(conf); }
--- a/src/server/daemon/acldata.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/daemon/acldata.c Tue Dec 30 21:44:49 2025 +0100 @@ -47,6 +47,6 @@ } ACLList* acl_get(ACLData *acldata, const char *name) { - ACLList *acl = cxMapGet(acldata->namedACLs, cx_hash_key_str(name)); + ACLList *acl = cxMapGet(acldata->namedACLs, name); return acl; }
--- a/src/server/daemon/config.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/daemon/config.c Tue Dec 30 21:44:49 2025 +0100 @@ -884,7 +884,7 @@ if(!ret) { if(name) { - cxMapPut(cfg->dav, cx_hash_key_str(name), repository); + cxMapPut(cfg->dav, name, repository); } else { log_ereport(LOG_FAILURE, "TODO: location based dav repositories not implemented"); ret = 1;
--- a/src/server/daemon/event.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/daemon/event.c Tue Dec 30 21:44:49 2025 +0100 @@ -145,7 +145,7 @@ } EVHandler* get_event_handler(const char *name) { - return cxMapGet(event_handler_map, cx_hash_key_str(name)); + return cxMapGet(event_handler_map, name); } EventHandler* ev_instance(EVHandler *ev) {
--- a/src/server/daemon/func.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/daemon/func.c Tue Dec 30 21:44:49 2025 +0100 @@ -63,7 +63,7 @@ } f->name = name; log_ereport(LOG_VERBOSE, "add_function %s", f->name); - cxMapPut(function_map, cx_hash_key_str(f->name), f); + cxMapPut(function_map, f->name, f); } void add_functions(FuncStruct *funcs) { @@ -81,7 +81,7 @@ name_dup[i] = '-'; } } - void *ret = cxMapGet(function_map, cx_hash_key_str(name_dup)); + void *ret = cxMapGet(function_map, name_dup); free(name_dup); return ret; }
--- a/src/server/daemon/httprequest.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/daemon/httprequest.c Tue Dec 30 21:44:49 2025 +0100 @@ -375,7 +375,7 @@ rq->port = request->connection->listener->port; if(rq->host) { - VirtualServer *vs = cxMapGet(sn->config->host_vs, cx_hash_key_str(rq->host)); + VirtualServer *vs = cxMapGet(sn->config->host_vs, rq->host); if(vs) { rq->vs = vs; } else {
--- a/src/server/daemon/keyfile_auth.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/daemon/keyfile_auth.c Tue Dec 30 21:44:49 2025 +0100 @@ -103,7 +103,7 @@ User* keyfile_get_user(AuthDB *db, Session *sn, Request *rq, const char *user) { Keyfile *keyfile = (Keyfile*)db; - return cxMapGet(keyfile->users, cx_hash_key_str(user)); + return cxMapGet(keyfile->users, user); } int keyfile_user_verify_password(User *user, const char *password) {
--- a/src/server/daemon/ldap_auth.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/daemon/ldap_auth.c Tue Dec 30 21:44:49 2025 +0100 @@ -661,7 +661,7 @@ LDAPGroup *group = ldap_get_group(user->sn, user->rq, authdb, group_str); if(group) { const char *usr = authdb->config.groupMemberType == WS_LDAP_GROUP_MEMBER_DN ? user->userdn : user->uid_attr; - char *member = cxMapGet(group->members, cx_hash_key_str(usr)); + char *member = cxMapGet(group->members, usr); if(member) { ret = 1; }
--- a/src/server/daemon/resourcepool.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/daemon/resourcepool.c Tue Dec 30 21:44:49 2025 +0100 @@ -48,7 +48,7 @@ } int resourcepool_register_type(const char *type_name, ResourceType *type_info) { - if(cxMapPut(resource_pool_types, cx_hash_key_str(type_name), type_info)) { + if(cxMapPut(resource_pool_types, type_name, type_info)) { log_ereport(LOG_CATASTROPHE, "resourcepool_register_type: OOM"); return 1; } @@ -132,13 +132,13 @@ // was this resource already used by this request? if(request && request->resources) { - resource = cxMapGet(request->resources, cx_hash_key_str(name)); + resource = cxMapGet(request->resources, name); if(resource) { return &resource->data; } } - ResourcePool *respool = cxMapGet(cfg->resources, cx_hash_key_str(name)); + ResourcePool *respool = cxMapGet(cfg->resources, name); if(!respool) return NULL; @@ -187,7 +187,7 @@ } if(request->resources) { - if(cxMapPut(request->resources, cx_hash_key_str(name), resource)) { + if(cxMapPut(request->resources, name, resource)) { err = 1; } } else { @@ -229,7 +229,7 @@ if(nsapi_rq && !nsapi_rq->finished) { // request processing still ongoing and SAFs will be executed - if(cxMapRemove(nsapi_rq->resources, cx_hash_key_str(respool->name))) { + if(cxMapRemove(nsapi_rq->resources, respool->name)) { log_ereport(LOG_FAILURE, "resourcepool_free: cannot remove resource from request: potential double free"); } }
--- a/src/server/daemon/vfs.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/daemon/vfs.c Tue Dec 30 21:44:49 2025 +0100 @@ -103,7 +103,7 @@ vfsType->init = vfsInit; vfsType->create = vfsCreate; - return cxMapPut(vfs_type_map, cx_hash_key_str(name), vfsType); + return cxMapPut(vfs_type_map, name, vfsType); } VfsType* vfs_get_type(cxstring vfs_class) { @@ -124,7 +124,7 @@ } VFS* vfs_create(Session *sn, Request *rq, const char *vfs_class, pblock *pb, void *initData) { - VfsType *vfsType = cxMapGet(vfs_type_map, cx_hash_key_str(vfs_class)); + VfsType *vfsType = cxMapGet(vfs_type_map, vfs_class); if(!vfsType) { log_ereport(LOG_MISCONFIG, "vfs_create: unkown VFS type %s", vfs_class); return NULL;
--- a/src/server/plugins/postgresql/config.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/plugins/postgresql/config.c Tue Dec 30 21:44:49 2025 +0100 @@ -344,7 +344,7 @@ } // check if the table was already specified - if(cxMapGet(ext->table_lookup, cx_hash_key_str(table))) { + if(cxMapGet(ext->table_lookup, table)) { log_ereport(LOG_MISCONFIG, "pg: config %s: extension table %s not unique", file_path, table); return 1; } @@ -360,7 +360,7 @@ int tableindex = (int)cxListSize(ext->tables); cxListAdd(ext->tables, &exttable); - if(cxMapPut(ext->table_lookup, cx_hash_key_str(table), (void*)table)) { + if(cxMapPut(ext->table_lookup, table, (void*)table)) { return 1; }
--- a/src/server/safs/auth.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/safs/auth.c Tue Dec 30 21:44:49 2025 +0100 @@ -243,7 +243,7 @@ // get auth db ServerConfiguration *config = session_get_config(sn); - AuthDB *authdb = cxMapGet(config->authdbs, cx_hash_key_str(db)); + AuthDB *authdb = cxMapGet(config->authdbs, db); User *auth_user = authdb->get_user(authdb, sn, rq, user); if(auth_user && !auth_user->verify_password(auth_user, pw)) {
--- a/src/server/safs/common.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/safs/common.c Tue Dec 30 21:44:49 2025 +0100 @@ -81,33 +81,33 @@ void common_saf_init() { var_names = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 32); - cxMapPut(var_names, cx_hash_key_str("insert-client"), (void*)(intptr_t)COMMONSAF_INSERT_CLIENT); - cxMapPut(var_names, cx_hash_key_str("insert-vars"), (void*)(intptr_t)COMMONSAF_INSERT_VARS); - cxMapPut(var_names, cx_hash_key_str("insert-reqpb"), (void*)(intptr_t)COMMONSAF_INSERT_REQPB); - cxMapPut(var_names, cx_hash_key_str("insert-headers"), (void*)(intptr_t)COMMONSAF_INSERT_HEADERS); - cxMapPut(var_names, cx_hash_key_str("insert-srvhdrs"), (void*)(intptr_t)COMMONSAF_INSERT_SRVHDRS); + cxMapPut(var_names, "insert-client", (void*)(intptr_t)COMMONSAF_INSERT_CLIENT); + cxMapPut(var_names, "insert-vars", (void*)(intptr_t)COMMONSAF_INSERT_VARS); + cxMapPut(var_names, "insert-reqpb", (void*)(intptr_t)COMMONSAF_INSERT_REQPB); + cxMapPut(var_names, "insert-headers", (void*)(intptr_t)COMMONSAF_INSERT_HEADERS); + cxMapPut(var_names, "insert-srvhdrs", (void*)(intptr_t)COMMONSAF_INSERT_SRVHDRS); - cxMapPut(var_names, cx_hash_key_str("set-client"), (void*)(intptr_t)COMMONSAF_SET_CLIENT); - cxMapPut(var_names, cx_hash_key_str("set-vars"), (void*)(intptr_t)COMMONSAF_SET_VARS); - cxMapPut(var_names, cx_hash_key_str("set-reqpb"), (void*)(intptr_t)COMMONSAF_SET_REQPB); - cxMapPut(var_names, cx_hash_key_str("set-headers"), (void*)(intptr_t)COMMONSAF_SET_HEADERS); - cxMapPut(var_names, cx_hash_key_str("set-srvhdrs"), (void*)(intptr_t)COMMONSAF_SET_SRVHDRS); + cxMapPut(var_names, "set-client", (void*)(intptr_t)COMMONSAF_SET_CLIENT); + cxMapPut(var_names, "set-vars", (void*)(intptr_t)COMMONSAF_SET_VARS); + cxMapPut(var_names, "set-reqpb", (void*)(intptr_t)COMMONSAF_SET_REQPB); + cxMapPut(var_names, "set-headers", (void*)(intptr_t)COMMONSAF_SET_HEADERS); + cxMapPut(var_names, "set-srvhdrs", (void*)(intptr_t)COMMONSAF_SET_SRVHDRS); - cxMapPut(var_names, cx_hash_key_str("remove-client"), (void*)(intptr_t)COMMONSAF_REMOVE_CLIENT); - cxMapPut(var_names, cx_hash_key_str("remove-vars"), (void*)(intptr_t)COMMONSAF_REMOVE_VARS); - cxMapPut(var_names, cx_hash_key_str("remove-reqpb"), (void*)(intptr_t)COMMONSAF_REMOVE_REQPB); - cxMapPut(var_names, cx_hash_key_str("remove-headers"), (void*)(intptr_t)COMMONSAF_REMOVE_HEADERS); - cxMapPut(var_names, cx_hash_key_str("remove-srvhdrs"), (void*)(intptr_t)COMMONSAF_REMOVE_SRVHDRS); + cxMapPut(var_names, "remove-client", (void*)(intptr_t)COMMONSAF_REMOVE_CLIENT); + cxMapPut(var_names, "remove-vars", (void*)(intptr_t)COMMONSAF_REMOVE_VARS); + cxMapPut(var_names, "remove-reqpb", (void*)(intptr_t)COMMONSAF_REMOVE_REQPB); + cxMapPut(var_names, "remove-headers", (void*)(intptr_t)COMMONSAF_REMOVE_HEADERS); + cxMapPut(var_names, "remove-srvhdrs", (void*)(intptr_t)COMMONSAF_REMOVE_SRVHDRS); - cxMapPut(var_names, cx_hash_key_str("abort"), (void*)(intptr_t)COMMONSAF_ABORT); - cxMapPut(var_names, cx_hash_key_str("noaction"), (void*)(intptr_t)COMMONSAF_NOACTION); - cxMapPut(var_names, cx_hash_key_str("error"), (void*)(intptr_t)COMMONSAF_ERROR); - cxMapPut(var_names, cx_hash_key_str("escape"), (void*)(intptr_t)COMMONSAF_ESCAPE); - cxMapPut(var_names, cx_hash_key_str("find-pathinfo-forward"), (void*)(intptr_t)COMMONSAF_FIND_PATHINFO_FORWARD); - cxMapPut(var_names, cx_hash_key_str("http-downgrade"), (void*)(intptr_t)COMMONSAF_HTTP_DOWNGRADE); - cxMapPut(var_names, cx_hash_key_str("http-upgrade"), (void*)(intptr_t)COMMONSAF_HTTP_UPGRADE); - cxMapPut(var_names, cx_hash_key_str("keep-alive"), (void*)(intptr_t)COMMONSAF_KEEP_ALIVE); - cxMapPut(var_names, cx_hash_key_str("name"), (void*)(intptr_t)COMMONSAF_NAME); + cxMapPut(var_names, "abort", (void*)(intptr_t)COMMONSAF_ABORT); + cxMapPut(var_names, "noaction", (void*)(intptr_t)COMMONSAF_NOACTION); + cxMapPut(var_names, "error", (void*)(intptr_t)COMMONSAF_ERROR); + cxMapPut(var_names, "escape", (void*)(intptr_t)COMMONSAF_ESCAPE); + cxMapPut(var_names, "find-pathinfo-forward", (void*)(intptr_t)COMMONSAF_FIND_PATHINFO_FORWARD); + cxMapPut(var_names, "http-downgrade", (void*)(intptr_t)COMMONSAF_HTTP_DOWNGRADE); + cxMapPut(var_names, "http-upgrade", (void*)(intptr_t)COMMONSAF_HTTP_UPGRADE); + cxMapPut(var_names, "keep-alive", (void*)(intptr_t)COMMONSAF_KEEP_ALIVE); + cxMapPut(var_names, "name", (void*)(intptr_t)COMMONSAF_NAME); webserver_atrestart(common_saf_cleanup, NULL); } @@ -151,7 +151,7 @@ } static int set_var(Session *sn, Request *rq, const char *var, char *value) { - intptr_t v = (intptr_t)cxMapGet(var_names, cx_hash_key_str(var)); + intptr_t v = (intptr_t)cxMapGet(var_names, var); switch(v) { default: break; case COMMONSAF_INSERT_CLIENT: var_set(value, sn->client, TRUE); break;
--- a/src/server/safs/nametrans.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/safs/nametrans.c Tue Dec 30 21:44:49 2025 +0100 @@ -69,7 +69,7 @@ if(!dav) return 0; ServerConfiguration *config = session_get_config(sn); - WebdavRepository *repo = cxMapGet(config->dav, cx_hash_key_str(dav)); + WebdavRepository *repo = cxMapGet(config->dav, dav); if(!repo) { log_ereport(LOG_MISCONFIG, "nametrans: unknown dav repository '%s'", dav);
--- a/src/server/test/vfs.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/test/vfs.c Tue Dec 30 21:44:49 2025 +0100 @@ -451,14 +451,14 @@ VFSEntry entry; while(vfs_readdir(dir, &entry)) { - cxMapPut(files, cx_hash_key_str(entry.name), dir); + cxMapPut(files, entry.name, dir); } CX_TEST_ASSERT(cxMapSize(files)== 4); - CX_TEST_ASSERT(cxMapGet(files, cx_hash_key_str("file1"))); - CX_TEST_ASSERT(cxMapGet(files, cx_hash_key_str("file2"))); - CX_TEST_ASSERT(cxMapGet(files, cx_hash_key_str("file3"))); - CX_TEST_ASSERT(cxMapGet(files, cx_hash_key_str("file4"))); + CX_TEST_ASSERT(cxMapGet(files, "file1")); + CX_TEST_ASSERT(cxMapGet(files, "file2")); + CX_TEST_ASSERT(cxMapGet(files, "file3")); + CX_TEST_ASSERT(cxMapGet(files, "file4")); cxMapFree(files);
--- a/src/server/webdav/multistatus.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/webdav/multistatus.c Tue Dec 30 21:44:49 2025 +0100 @@ -57,7 +57,7 @@ if(!ms->namespaces) { return NULL; } - if(cxMapPut(ms->namespaces, cx_hash_key_str("D"), webdav_dav_namespace())) { + if(cxMapPut(ms->namespaces, "D", webdav_dav_namespace())) { return NULL; } return ms; @@ -573,12 +573,12 @@ if(property->namespace->prefix) { WSNamespace *ns = cxMapGet( response->multistatus->namespaces, - cx_hash_key_str((const char*)property->namespace->prefix)); + property->namespace->prefix); if(!ns) { // prefix is not in use -> we can add the namespace to the ns map int err = cxMapPut( response->multistatus->namespaces, - cx_hash_key_str((const char*)property->namespace->prefix), + (const char*)property->namespace->prefix, property->namespace); if(err) { return 1; // OOM
--- a/src/server/webdav/webdav.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/webdav/webdav.c Tue Dec 30 21:44:49 2025 +0100 @@ -112,7 +112,7 @@ WebdavType webdavType; webdavType.init = webdavInit; webdavType.create = webdavCreate; - return cxMapPut(webdav_type_map, cx_hash_key_str(name), &webdavType); + return cxMapPut(webdav_type_map, name, &webdavType); } WebdavType* webdav_get_type(cxstring dav_class) { @@ -133,7 +133,7 @@ } WebdavBackend* webdav_create(Session *sn, Request *rq, const char *dav_class, pblock *pb, void *initData) { - WebdavType *webdavType = cxMapGet(webdav_type_map, cx_hash_key_str(dav_class)); + WebdavType *webdavType = cxMapGet(webdav_type_map, dav_class); if(!webdavType) { log_ereport(LOG_MISCONFIG, "webdav_create: unkown dav type %s", dav_class); return NULL; @@ -168,30 +168,30 @@ return REQ_ABORTED; } - cxMapPut(method_handler_map, cx_hash_key_str("OPTIONS"), webdav_options); - cxMapPut(method_handler_map, cx_hash_key_str("PROPFIND"), webdav_propfind); - cxMapPut(method_handler_map, cx_hash_key_str("PROPPATCH"), webdav_proppatch); - cxMapPut(method_handler_map, cx_hash_key_str("MKCOL"), webdav_mkcol); - cxMapPut(method_handler_map, cx_hash_key_str("POST"), webdav_post); - cxMapPut(method_handler_map, cx_hash_key_str("DELETE"), webdav_delete); - cxMapPut(method_handler_map, cx_hash_key_str("PUT"), webdav_put); - cxMapPut(method_handler_map, cx_hash_key_str("COPY"), webdav_copy); - cxMapPut(method_handler_map, cx_hash_key_str("MOVE"), webdav_move); - cxMapPut(method_handler_map, cx_hash_key_str("LOCK"), webdav_lock); - cxMapPut(method_handler_map, cx_hash_key_str("UNLOCK"), webdav_unlock); - cxMapPut(method_handler_map, cx_hash_key_str("REPORT"), webdav_report); - cxMapPut(method_handler_map, cx_hash_key_str("ACL"), webdav_acl); + cxMapPut(method_handler_map, "OPTIONS", webdav_options); + cxMapPut(method_handler_map, "PROPFIND", webdav_propfind); + cxMapPut(method_handler_map, "PROPPATCH", webdav_proppatch); + cxMapPut(method_handler_map, "MKCOL", webdav_mkcol); + cxMapPut(method_handler_map, "POST", webdav_post); + cxMapPut(method_handler_map, "DELETE", webdav_delete); + cxMapPut(method_handler_map, "PUT", webdav_put); + cxMapPut(method_handler_map, "COPY", webdav_copy); + cxMapPut(method_handler_map, "MOVE", webdav_move); + cxMapPut(method_handler_map, "LOCK", webdav_lock); + cxMapPut(method_handler_map, "UNLOCK", webdav_unlock); + cxMapPut(method_handler_map, "REPORT", webdav_report); + cxMapPut(method_handler_map, "ACL", webdav_acl); - cxMapPut(method_handler_map, cx_hash_key_str("SEARCH"), webdav_search); + cxMapPut(method_handler_map, "SEARCH", webdav_search); - cxMapPut(method_handler_map, cx_hash_key_str("VERSION-CONTROL"), webdav_version_control); - cxMapPut(method_handler_map, cx_hash_key_str("CHECKOUT"), webdav_checkout); - cxMapPut(method_handler_map, cx_hash_key_str("CHECKIN"), webdav_checkin); - cxMapPut(method_handler_map, cx_hash_key_str("UNCHECKOUT"), webdav_uncheckout); - cxMapPut(method_handler_map, cx_hash_key_str("MKWORKSPACE"), webdav_mkworkspace); - cxMapPut(method_handler_map, cx_hash_key_str("UPDATE"), webdav_update); - cxMapPut(method_handler_map, cx_hash_key_str("LABEL"), webdav_label); - cxMapPut(method_handler_map, cx_hash_key_str("MERGE"), webdav_merge); + cxMapPut(method_handler_map, "VERSION-CONTROL", webdav_version_control); + cxMapPut(method_handler_map, "CHECKOUT", webdav_checkout); + cxMapPut(method_handler_map, "CHECKIN", webdav_checkin); + cxMapPut(method_handler_map, "UNCHECKOUT", webdav_uncheckout); + cxMapPut(method_handler_map, "MKWORKSPACE", webdav_mkworkspace); + cxMapPut(method_handler_map, "UPDATE", webdav_update); + cxMapPut(method_handler_map, "LABEL", webdav_label); + cxMapPut(method_handler_map, "MERGE", webdav_merge); dav_namespace.href = (xmlChar*)"DAV:"; dav_namespace.prefix = (xmlChar*)"D";
--- a/src/server/webdav/xml.c Wed Dec 17 22:15:48 2025 +0100 +++ b/src/server/webdav/xml.c Tue Dec 30 21:44:49 2025 +0100 @@ -581,7 +581,7 @@ writer_putc (out, '"'); } else { WSNamespace *n = xw->namespaces ? - cxMapGet(xw->namespaces, cx_hash_key_str((const char*)nsdef->prefix)) : + cxMapGet(xw->namespaces, nsdef->prefix) : NULL; if(!n) { writer_put_lit(out, " xmlns:");