EAPI Eina_Bool eina_hash_del(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1);
EAPI void * eina_hash_find(const Eina_Hash *hash, const void *key) EINA_ARG_NONNULL(1, 2);
EAPI void * eina_hash_modify(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1, 2, 3);
-EAPI void * eina_hash_modify_or_add(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1, 2, 3);
+EAPI void * eina_hash_set(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1, 2, 3);
EAPI void eina_hash_free(Eina_Hash *hash) EINA_ARG_NONNULL(1);
EAPI void eina_hash_free_buckets(Eina_Hash *hash) EINA_ARG_NONNULL(1);
EAPI int eina_hash_population(const Eina_Hash *hash) EINA_ARG_NONNULL(1);
return NULL;
}
+/**
+ * @brief Create a new hash using the djb2 algorithm.
+ * @param data_free_cb The function to call on values when the hash table is freed
+ * @return The @ref Eina_Hash object, or @c NULL on error
+ * Use to create a new hash using the djb2 algorithm for table management and strcmp to compare keys.
+ * NOTE: If your hash is created by this, you CAN look up values with pointers other
+ * than the original key pointer that was used to add a value.
+ */
EAPI Eina_Hash *
eina_hash_string_djb2_new(Eina_Free_Cb data_free_cb)
{
* @brief Create a new hash for use with strings.
* @param data_free_cb The function to call on values when the hash table is freed
* @return The @ref Eina_Hash object, or @c NULL on error
- * Use to create a new hash for use with strings.
+ * Use to create a new hash using the superfast algorithm for table management and strcmp to compare keys.
* NOTE: If your hash is created by this, you CAN look up values with pointers other
* than the original key pointer that was used to add a value.
*/
* function to use, use this one.
* @param data_free_cb The function to call on values when the hash table is freed
* @return The @ref Eina_Hash object, or @c NULL on error
- * Use to create a new hash with small bucket size for use with strings.
+ * Use to create a new hash using the superfast algorithm for table management and strcmp to compare keys.
+ * This method also uses a reduced bucket size which will minimize the memory used by the table.
* If you are unsure of which hash creation function to use, you should probably use this one.
* NOTE: If your hash is created by this, you CAN look up values with pointers other
* than the original key pointer that was used to add a value.
EINA_HASH_SMALL_BUCKET_SIZE);
}
+/**
+ * @brief Create a new hash for use with 32bit ints
+ * @param data_free_cb The function to call on values when the hash table is freed
+ * @return The @ref Eina_Hash object, or @c NULL on error
+ * Use to create a new hash using the int32 algorithm for table management and dereferenced
+ * pointers to compare keys.
+ * NOTE: If your hash is created by this, you CAN look up values with pointers other
+ * than the original key pointer that was used to add a value. Also note that while this method may
+ * appear to be able to match string keys, it is really only matching the first character.
+ */
EAPI Eina_Hash *
eina_hash_int32_new(Eina_Free_Cb data_free_cb)
{
EINA_HASH_BUCKET_SIZE);
}
+/**
+ * @brief Create a new hash for use with 64bit ints
+ * @param data_free_cb The function to call on values when the hash table is freed
+ * @return The @ref Eina_Hash object, or @c NULL on error
+ * Use to create a new hash using the int64 algorithm for table management and dereferenced
+ * pointers to compare keys.
+ * NOTE: If your hash is created by this, you CAN look up values with pointers other
+ * than the original key pointer that was used to add a value. Also note that while this method may
+ * appear to be able to match string keys, it is really only matching the first character.
+ */
EAPI Eina_Hash *
eina_hash_int64_new(Eina_Free_Cb data_free_cb)
{
EINA_HASH_BUCKET_SIZE);
}
+/**
+ * @brief Create a new hash for use with pointers
+ * @param data_free_cb The function to call on values when the hash table is freed
+ * @return The @ref Eina_Hash object, or @c NULL on error
+ * Use to create a new hash using the int64 algorithm for table management and dereferenced
+ * pointers to compare keys.
+ * NOTE: If your hash is created by this, you CAN look up values with pointers other
+ * than the original key pointer that was used to add a value. Also note that while this method may
+ * appear to be able to match string keys, it is really only matching the first character.
+ */
EAPI Eina_Hash *
eina_hash_pointer_new(Eina_Free_Cb data_free_cb)
{
* of whether it is there. To check for errors, use @ref eina_error_get
*/
EAPI void *
-eina_hash_modify_or_add(Eina_Hash *hash, const void *key, const void *data)
+eina_hash_set(Eina_Hash *hash, const void *key, const void *data)
{
Eina_Hash_Tuple tuple;
Eina_Hash_Head *eh;