SysTutorials

Linux Manual Pages › Section 3

dictmodifyvalue(3)

dictModifyValue – create/modify an item.

Synopsis

#include <util/dict.h>
NEOERR *dictModifyValue(dictCtx dict, const char *id, dictNewValueCB new_cb, 
                     dictUpdateValueCB update, void *rock);

Arguments

dict – dictionary to add pair to.
id – identifier of value
new – function to call to create new value (may be NULL)
update – function to call to modify value (if NULL, the old
value is freed, and <new> is used)
rock – context to pass to <new> or <update>.

Description

Finds <id>’s value and calls <update>. If <id> is not in <dict>, calls <new> to obtain a new value.

MT-Level: Safe if <dict> thread-safe.

Return Value

None.

See Also

dictDestroy(3), dictCleanup(3), dictReleaseLock(3), dictRemove(3), dictNext(3), dictCreate(3), dictSetValue(3), dictModifyValue(3), dictSearch