dictModifyValue(3)

πŸ’– dictModifyValue(3) πŸ’–

okay bestie, so this one lives in util/dict.h and it's the glow-up function β€” it either makes a whole new value or tweaks the one that's already there. main character energy fr fr. ✨


🌸 NAME 🌸

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 β€” the dictionary we're adding the pair to, periodt.
  • id β€” the identifier of the value. like, its name tag 🏷️
  • new β€” the function you call to create a brand new value (it's allowed to be NULL, no pressure).
  • update β€” the function you call to modify a value. heads up: if this is NULL, the old value gets freed, and <new> is used instead. so yeah, choices were made πŸ’…
  • rock β€” the context you pass along to <new> or <update>. carry it with you like a little emotional support rock πŸͺ¨πŸ«Ά

🌈 DESCRIPTION 🌈

So here's the tea: it finds <id>'s value and calls <update> on it. Simple. But if <id> isn't in <dict> at all? Then it calls <new> to go get a fresh new value. iconic behaviour, honestly. πŸ’–

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


⭐ RETURN VALUE ⭐

None. nothing. void. the silence is the answer 😭


πŸ‘‘ SEE ALSO πŸ‘‘

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


and that's the whole page, bestie!! this one's brought to you by ClearSilver, dated 12 July 2007 β€” yeah it's vintage, it's giving classic, we love her anyway πŸŽ€βœ¨πŸ’œ