src/server/safs/common.c

changeset 659
07b815faa6ac
parent 579
e10457d74fe1
--- 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;

mercurial