gdataset: add assertions that we never add a zero key

All public API already ensures that this cannot ever happen.

The assertion is only for the reviewer and ease of mind.
This commit is contained in:
Thomas Haller
2025-05-09 11:34:15 +02:00
parent 8df7da0cc2
commit 8a273a7a3e

View File

@@ -301,6 +301,10 @@ datalist_append (GData **data, GQuark key_id, gpointer new_data, GDestroyNotify
gboolean reallocated;
GData *d;
#ifdef G_ENABLE_DEBUG
g_assert (key_id != 0);
#endif
d = *data;
if (!d)
{
@@ -613,6 +617,10 @@ g_data_set_internal (GData **datalist,
GDataElt old, *data;
guint32 idx;
#ifdef G_ENABLE_DEBUG
g_assert (key_id != 0);
#endif
d = g_datalist_lock_and_get (datalist);
data = datalist_find (d, key_id, &idx);