DataList.idReplaceData

Compares the member that is associated with key_id in datalist to oldval, and if they are the same, replace oldval with newval. This is like a typical atomic compare-and-exchange operation, for a member of datalist. If the previous value was replaced then ownership of the old value (oldval) is passed to the caller, including the registred destroy notify for it (passed out in old_destroy). Its up to the caller to free this as he wishes, which may or may not include using old_destroy as sometimes replacement should not destroy the object in the normal way. Return: TRUE if the existing value for key_id was replaced by newval, FALSE otherwise. Since 2.34

class DataList
static
int
idReplaceData

Parameters

datalist GData**

location of a datalist

keyId GQuark

the GQuark identifying a data element

oldval void*

the old value to compare against. [allow-none]

newval void*

the new value to replace it with. [allow-none]

destroy GDestroyNotify

destroy notify for the new value. [allow-none]

oldDestroy GDestroyNotify*

destroy notify for the existing value. [allow-none]

Meta