docs: Amend the docs for g_str_equal() to reflect current general usage

People do (and should) use g_str_equal() for string comparisons outside
of hash tables, because it’s easier to read than
`strcmp (str1, str2) == 0`. That should not be discouraged.

However, we should still be careful to point out that g_str_equal() is
not NULL-safe, and g_strcmp0() is.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2018-06-14 18:12:42 +01:00
parent 2fe4fa6cd0
commit ac690d9a8c

View File

@ -1909,9 +1909,9 @@ g_hash_table_get_values (GHashTable *hash_table)
* @key_equal_func parameter, when using non-%NULL strings as keys in a * @key_equal_func parameter, when using non-%NULL strings as keys in a
* #GHashTable. * #GHashTable.
* *
* Note that this function is primarily meant as a hash table comparison * This function is typically used for hash table comparisons, but can be used
* function. For a general-purpose, %NULL-safe string comparison function, * for general purpose comparisons of non-%NULL strings. For a %NULL-safe string
* see g_strcmp0(). * comparison function, see g_strcmp0().
* *
* Returns: %TRUE if the two keys match * Returns: %TRUE if the two keys match
*/ */