From 10d4351ec9c65b07edc9b7fca43143860c52a79a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 5 Feb 2024 15:45:29 +0100 Subject: [PATCH] gdataset: add code comment to g_datalist_get_data() It's not obvious why we wouldn't use g_quark_try_string(). Add a code comment that this is intentional and a reference for how to find out more. Also, fix typo in another code comment. --- glib/gdataset.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/glib/gdataset.c b/glib/gdataset.c index 442389b19..992e17368 100644 --- a/glib/gdataset.c +++ b/glib/gdataset.c @@ -211,7 +211,7 @@ datalist_remove (GData *data, guint32 idx) /* g_data_remove_internal() relies on the fact, that this function removes * the entry similar to g_array_remove_index_fast(). That is, the entries up - * to @idx are left unchanged, and the last entry at moved to position @idx. + * to @idx are left unchanged, and the last entry is moved to position @idx. * */ data->len--; @@ -1244,6 +1244,12 @@ g_datalist_get_data (GData **datalist, data_end = data + d->len; while (data < data_end) { + /* Here we intentionally compare by strings, instead of calling + * g_quark_try_string() first. + * + * See commit 1cceda49b60b ('Make g_datalist_get_data not look up the + * quark'). + */ if (g_strcmp0 (g_quark_to_string (data->key), key) == 0) { res = data->data;