Merge branch 'th/gdataset-comment' into 'main'

[th/gdataset-comment] gdataset: add code comment to g_datalist_get_data()

See merge request GNOME/glib!3879
This commit is contained in:
Philip Withnall 2024-02-05 16:52:00 +00:00
commit f2814e36ef

View File

@ -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;