[glib: 1/2] docs: Amend the docs for g_str_equal() to reflect current general usage
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] docs: Amend the docs for g_str_equal() to reflect current general usage
- Date: Fri, 15 Jun 2018 14:54:30 +0000 (UTC)
commit ac690d9a8c3297967415f97dabaeff9adb796668
Author: Philip Withnall <withnall endlessm com>
Date: Thu Jun 14 18:12:42 2018 +0100
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>
glib/ghash.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/glib/ghash.c b/glib/ghash.c
index d93169066..433004cf8 100644
--- a/glib/ghash.c
+++ b/glib/ghash.c
@@ -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
* #GHashTable.
*
- * Note that this function is primarily meant as a hash table comparison
- * function. For a general-purpose, %NULL-safe string comparison function,
- * see g_strcmp0().
+ * This function is typically used for hash table comparisons, but can be used
+ * for general purpose comparisons of non-%NULL strings. For a %NULL-safe string
+ * comparison function, see g_strcmp0().
*
* Returns: %TRUE if the two keys match
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]