--- a/src/cx/kv_list.h Tue Sep 16 22:32:23 2025 +0200 +++ b/src/cx/kv_list.h Wed Sep 17 22:45:00 2025 +0200 @@ -213,27 +213,6 @@ } cx_attr_nonnull -static inline int cxKvListRemoveKey(CxList *list, size_t index, CxHashKey key) { - return cx_kv_list_remove_key(list, index, key); -} - -cx_attr_nonnull -static inline int cxKvListRemoveKey(CxList *list, size_t index, cxstring key) { - return cx_kv_list_remove_key(list, index, cx_hash_key_cxstr(key)); -} - -cx_attr_nonnull -static inline int cxKvListRemoveKey(CxList *list, size_t index, cxmutstr key) { - return cx_kv_list_remove_key(list, index, cx_hash_key_cxstr(key)); -} - -cx_attr_nonnull -cx_attr_cstr_arg(3) -static inline int cxKvListRemoveKey(CxList *list, size_t index, const char *key) { - return cx_kv_list_remove_key(list, index, cx_hash_key_str(key)); -} - -cx_attr_nonnull static inline int cxKvListInsert(CxList *list, size_t index, CxHashKey key, void *value) { return cx_kv_list_insert(list, index, key, value); } @@ -292,40 +271,20 @@ } /** - * Removes the key for a list item. + * Removes the key of a list item. + * + * This can be useful if you want to explicitly remove an item from the lookup map. * - * This can be useful if you want to explicitly remove an item from the lookup map, - * for example, when you want to prevent a deletion by cxMapClear(). + * If no key is associated with the item, nothing happens, and this function returns zero. * - * @param list (@c CxList*) the list - * @param index (@c size_t) the index of the element in the list - * @param key (@c CxHashKey, @c char*, @c cxstring, or @c cxmutstr) the key + * @param list the list + * @param index the index of the element in the list * @retval zero success * @retval non-zero the index is out of bounds */ -#define cxKvListRemoveKey(list, index, key) _Generic((key), \ - CxHashKey: cx_kv_list_remove_key, \ - cxstring: cx_kv_list_remove_key_cxstr, \ - cxmutstr: cx_kv_list_remove_key_mustr, \ - char*: cx_kv_list_remove_key_str, \ - const char*: cx_kv_list_remove_key_str) \ - (list, index, key) - cx_attr_nonnull -static inline int cx_kv_list_remove_key_cxstr(CxList *list, size_t index, cxstring key) { - return cx_kv_list_remove_key(list, index, cx_hash_key_cxstr(key)); -} - -cx_attr_nonnull -static inline int cx_kv_list_remove_key_mustr(CxList *list, size_t index, cxmutstr key) { - return cx_kv_list_remove_key(list, index, cx_hash_key_cxstr(key)); -} - -cx_attr_nonnull -cx_attr_cstr_arg(3) -static inline int cx_kv_list_remove_key_str(CxList *list, size_t index, const char *key) { - return cx_kv_list_remove_key(list, index, cx_hash_key_str(key)); -} +cx_attr_export +int cxKvListRemoveKey(CxList *list, size_t index); /** * Inserts an item into the list at the specified index and associates it with the specified key.