src/cx/hash_key.h

changeset 1050
3df63e95921a
parent 1049
415bf2ce6bab
--- a/src/cx/hash_key.h	Sun Dec 22 22:53:53 2024 +0100
+++ b/src/cx/hash_key.h	Sun Dec 22 23:10:07 2024 +0100
@@ -118,46 +118,27 @@
         size_t len
 );
 
-#ifdef __cplusplus
-} // extern "C"
-
-cx_attr_nodiscard
-static inline CxHashKey cx_hash_key_cxstr(cxstring str) {
-    return cx_hash_key(str.ptr, str.length);
-}
-
-cx_attr_nodiscard
-static inline CxHashKey cx_hash_key_cxstr(cxmutstr str) {
-    return cx_hash_key(str.ptr, str.length);
-}
-
-#else
 /**
  * Computes a hash key from a UCX string.
  *
  * @param str the string
  * @return the hash key
  */
-#define cx_hash_key_cxstr(str) _Generic((str), \
-    cxstring: cx_hash_key_cxstring, \
-    cxmutstr: cx_hash_key_cxmutstr) \
-    (str)
-
-/**
- * @copydoc cx_hash_key_cxstr()
- */
 cx_attr_nodiscard
-static inline CxHashKey cx_hash_key_cxstring(cxstring str) {
+static inline CxHashKey cx_hash_key_cxstr(cxstring str) {
     return cx_hash_key(str.ptr, str.length);
 }
 
 /**
- * @copydoc cx_hash_key_cxstr()
+ * Computes a hash key from a UCX string.
+ *
+ * @param str the string
+ * @return the hash key
  */
-cx_attr_nodiscard
-static inline CxHashKey cx_hash_key_cxmutstr(cxmutstr str) {
-    return cx_hash_key(str.ptr, str.length);
-}
+#define cx_hash_key_cxstr(str) cx_hash_key_cxstr(cx_strcast(str))
+
+#ifdef __cplusplus
+} // extern "C"
 #endif
 
 #endif // UCX_HASH_KEY_H

mercurial