GENDERS_NODELIST_CREATE(3)

πŸ’… GENDERS_NODELIST_CREATE(3) β€” the libgenders list girlies ✨

okay bestie, sit down, hydrate, because this one is literally nine functions in a trench coat and they are ALL about lists. we're in section 3, we're from libgenders, and we are about to create, clear and destroy arrays of strings like it's our whole personality. πŸŽ€


🌸 NAME 🌸

genders_nodelist_create, genders_nodelist_clear, genders_nodelist_destroy, genders_attrlist_create, genders_attrlist_clear, genders_attrlist_destroy, genders_vallist_create, genders_vallist_clear, genders_vallist_destroy β€” the list create, clear, and destroy routines. that's it. that's the family. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <genders.h>

int genders_nodelist_create(genders_t handle, char ***nodelist);

int genders_nodelist_clear(genders_t handle, char **nodelist);

int genders_nodelist_destroy(genders_t handle, char **nodelist);

int genders_attrlist_create(genders_t handle, char ***attrlist);

int genders_attrlist_clear(genders_t handle, char **attrlist);

int genders_attrlist_destroy(genders_t handle, char **attrlist);

int genders_vallist_create(genders_t handle, char ***vallist);

int genders_vallist_clear(genders_t handle, char **vallist);

int genders_vallist_destroy(genders_t handle, char **vallist);

✨ DESCRIPTION ✨

so. genders_nodelist_create(), genders_nodelist_clear(), genders_nodelist_destroy(), genders_attrlist_create(), genders_attrlist_clear(), genders_attrlist_destroy(), genders_vallist_create(), genders_vallist_clear(), and genders_vallist_destroy() are the ones you call to create, clear, and destroy lists β€” and by "lists" we mean arrays of strings, bestie, not your Notes app grocery list πŸ“ β€” for use with genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3).

🧚 the create girlies

genders_nodelist_create(), genders_attrlist_create(), and genders_vallist_create() create a list with the minimum size needed to store nodes, attributes, and attribute values respectively. nodelist, attrlist, and vallist get set to point at the list that was just created. and the created lists are guaranteed to store all the node, attribute, and value info that comes back from genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3). no cap, they sized it for you already πŸ’–

🫢 the clear girlies

genders_nodelist_clear(), genders_attrlist_clear(), and genders_vallist_clear() clear out whatever info is chilling in the lists pointed to by nodelist, attrlist, and vallist respectively.

and listen β€” you do not have to call these right after their respective create functions. nope. you only call them after the lists have been used in genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3), and the programmer (that's you, main character) wishes to re-use the list. recycling is iconic, periodt ♻️

πŸ’€ the destroy girlies

genders_nodelist_destroy(), genders_attrlist_destroy(), and genders_vallist_destroy() destroy the lists pointed to by nodelist, attrlist, and vallist respectively. bye bestie, thanks for the memories πŸŽ€

πŸ™ˆ the plot twist

if no attributes or values are listed in the genders database, then all of the attrlist and vallist functions will do nothing. literally nothing. and the pointer you passed into genders_attrlist_create() and genders_vallist_create() will not be set. so don't come for her when she's empty, she warned you 😭


🌈 RETURN VALUES 🌈

on success, genders_nodelist_create(), genders_attrlist_create(), and genders_vallist_create() return the number of elements the created list can store. yes, a count, she's giving receipts.

on success, genders_nodelist_clear(), genders_attrlist_clear(), genders_vallist_clear(), genders_nodelist_destroy(), genders_attrlist_destroy(), and genders_vallist_destroy() return 0. clean, simple, no drama.

on error, -1 is returned, and an error code is returned in handle. you can grab that error code with genders_errnum(3), and get a lil description of it with genders_strerror(3). the error codes live in genders.h. πŸ‘‘


πŸ”₯ ERRORS πŸ”₯

  • GENDERS_ERR_NULLHANDLE β€” the handle parameter is NULL. bestie you gotta make that genders handle first, with genders_handle_create(3). no handle, no service πŸ’…
  • GENDERS_ERR_NOTLOADED β€” genders_load_data(3) has not been called to load genders data. and like, before lists of the appropriate size can be created, the genders file has to be read and parsed. that's just the rules. πŸ¦‹
  • GENDERS_ERR_PARAMETERS β€” an incorrect parameter has been passed in. wrong vibe, wrong input, rejected. πŸ™ˆ
  • GENDERS_ERR_NULLPTR β€” a null pointer has been found in the list passed in. she checked, and there was a void where a pointer should be πŸ’€
  • GENDERS_ERR_OUTMEM β€” malloc(3) has failed internally, system is out of memory. not her fault, the machine is simply not serving cunt today 😭
  • GENDERS_ERR_MAGIC β€” handle has an incorrect magic number. meaning: handle does not point to a genders handle, or handle has been destroyed by genders_handle_destroy(3). the magic is gone, literally βœ¨πŸ’€

πŸŽ€ FILES πŸŽ€

  • /usr/include/genders.h

πŸ’œ SEE ALSO πŸ’œ

libgenders(3), genders_handle_create(3), genders_load_data(3), genders_getnodes(3), genders_getattr(3), genders_getattr_all(3), genders_errnum(3), genders_strerror(3)


ok that's the whole page, bestie. go forth, create your lists, clear them, destroy them, and be normal about it (you won't be, and that's fine). 🫢

this lil masterpiece came courtesy of LLNL, dated August 2003 β€” yeah she's vintage, she's archival, she's still serving. mwah. πŸ’‹