g_hash_table_new (
  GHashFunc hash_func,
  GEqualFunc key_equal_func


Creates a new GHashTable with a reference count of 1.

Hash values returned by hash_func are used to determine where keys are stored within the GHashTable data structure. The g_direct_hash(), g_int_hash(), g_int64_hash(), g_double_hash() and g_str_hash() functions are provided for some common types of keys. If hash_func is NULL, g_direct_hash() is used.

key_equal_func is used when looking up keys in the GHashTable. The g_direct_equal(), g_int_equal(), g_int64_equal(), g_double_equal() and g_str_equal() functions are provided for the most common types of keys. If key_equal_func is NULL, keys are compared directly in a similar fashion to g_direct_equal(), but without the overhead of a function call. key_equal_func is called with the key from the hash table as its first parameter, and the user-provided key to check against as its second.



Type: GHashFunc

A function to create a hash value from a key.


Type: GEqualFunc

A function to check two keys for equality.

Return value

Type: GHashTable

A new GHashTable.

The data is owned by the called function.