skipInsert(3)

πŸ’– skipInsert(3) πŸ’–

okay bestie, welcome to skipInsert from util/skiplist.h β€” section 3 of the manual, the little corner of the docs where we insert stuff into skiplists. she's simple, she's iconic, she has one job and she does it. let's go πŸ¦‹


🌸 NAME 🌸

skipInsert β€” insert an item. that's it. that's the whole name. short king energy πŸ‘‘


✨ SYNOPSIS ✨

#include <util/skiplist.h>

NEOERR *skipInsert(skipList list, UINT32 key, void *value, int allowUpdate);

like look at that signature. she's giving function. she's giving NEOERR *. she's literally returning a pointer to a NEOERR and we will talk about that in a sec πŸ™ˆ


πŸŽ€ ARGUMENTS πŸŽ€

  • list β€” the list you're adding your pair to. your canvas. your stage. the skiplist in question πŸ’…
  • key β€” the key that identifies value. she's the name tag, she's the vibe check, she's how you find your value later.
  • value β€” the value you're storing. and bestie, hear me: this may NOT be NULL. not optional. not negotiable. do not pass NULL. i'm serious. 😭
  • allowUpdate β€” the drama switch. more on her below.

πŸ”₯ DESCRIPTION πŸ”₯

so what does she actually do? she inserts the key/value pair into the list. that's the whole plot. no cap. ✨

but now the lore:

  • key values 0 and -1 are reserved β€” and like, illegal. do not come for them. they are not for you. 🚫
  • if the key is already in the list, and allowUpdate is true, then the value gets updated. slay, in-place glow-up πŸ’–
  • if the key is already in the list and allowUpdate is not true, you get SKIPERR_EXISTS returned at you. it's giving "we already have one at home" πŸ’€
MT-Level: Safe if list is thread-safe. that's it, that's the whole caveat. if your list isn't thread-safe, neither is this. don't be shocked. 🌈

⭐ RETURN VALUE ⭐

None.

yes, really. the signature returns NEOERR * and the manual says None. the documentation is out here living its own life and honestly? respect. πŸ™ˆβœ¨


🫢 SEE ALSO 🫢

go be nosy, she runs with a whole crew:


mwah πŸ’‹ that's the page. brought to you by ClearSilver, dated 12 July 2007 β€” yeah she's vintage, she's a classic, she's still out here inserting items. periodt. πŸŽ€βœ¨