gdataset: refactor check for old value in g_datalist_id_replace_data()

GData does not support to track NULL values.

That means, the existing value is NULL if-and-only-if the GDataElt is
NULL. Thus the check for `if (val == NULL && ...` is already covered by
`if (data)` above, and we can move that to the else branch.
This commit is contained in:
Thomas Haller
2025-02-25 17:34:22 +01:00
parent a1e9284f47
commit 4a9d93d7eb

View File

@@ -1371,12 +1371,12 @@ g_datalist_id_replace_data (GData **datalist,
}
}
}
if (val == NULL && oldval == NULL && newval != NULL)
else
{
if (datalist_append (&d, key_id, newval, destroy))
if (oldval == NULL && newval != NULL)
{
set_d = TRUE;
if (datalist_append (&d, key_id, newval, destroy))
set_d = TRUE;
}
}