GENDERS_NODELIST_CREATE(3)

πŸ“¦
version 1.32 Β· 3 versions
, in epel 10, fedora 43, fedora 44, opensuse-leap 16.0

✨ GENDERS_NODELIST_CREATE ✨

okay bestie, welcome to the libgenders list-management corner of the universe πŸ’… this is GENDERS_NODELIST_CREATE(3) from LIBGENDERS, and it's literally the page about making lists, wiping lists, and yeeting lists out of existence. no cap.


🌸 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, aka the whole glow-up-and-glow-down pipeline πŸ¦‹


πŸŽ€ 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 like, here's the vibe: 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 nine icons you use to create, clear, and destroy lists (which are just arrays of strings, bestie) so you can hand them over to genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3). 🫢

genders_nodelist_create(), genders_attrlist_create(), and genders_vallist_create() create a list with the minimum size to store nodes, attributes, and attribute values respectively. and then nodelist, attrlist, and vallist get set to point at the list that was just created β€” main character entrance, honestly πŸ‘‘

and here's the part that hits: these created lists are guaranteed to store all the node, attribute, and value information that comes back from genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3). no overflow jumpscares. we love that for us.

genders_nodelist_clear(), genders_attrlist_clear(), and genders_vallist_clear() clear out any information stored in the lists pointed to by nodelist, attrlist, and vallist respectively. and no, you do not have to call them after their respective create functions β€” they're independent queens πŸ’…. you only have to call them after the lists have been used in genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3), and the programmer wishes to re-use the list. recycling era ♻️

genders_nodelist_destroy(), genders_attrlist_destroy(), and genders_vallist_destroy() destroy the lists pointed to by nodelist, attrlist, and vallist respectively. say bye bestie, it's their time 😭

⚠️ big one, do not skip: if no attributes or values are listed in the genders database, all of the attrlist and vallist functions will do nothing. and the pointer passed into genders_attrlist_create() and genders_vallist_create() will not be set. so don't go dereferencing it like it's gonna be something. it's not. periodt.

⭐ RETURN VALUES ⭐

on success, genders_nodelist_create(), genders_attrlist_create(), and genders_vallist_create() return the number of elements the created list can store. slay.

on success, genders_nodelist_clear(), genders_attrlist_clear(), genders_vallist_clear() genders_nodelist_destroy(), genders_attrlist_destroy(), genders_vallist_destroy() return 0. πŸŽ€

on error, -1 is returned, and an error code is returned in handle. you can grab that error code with genders_errnum(3), and a description of the error code with genders_strerror(3). and psst β€” error codes are defined in genders.h. iykyk πŸ“–


πŸ’€ ERRORS πŸ’€

  • GENDERS_ERR_NULLHANDLE β€” the handle parameter is NULL. the genders handle must be created with genders_handle_create(3). like, you can't show up to the party with no invite πŸ™ˆ
  • GENDERS_ERR_NOTLOADED β€” genders_load_data(3) has not been called to load genders data. before lists of appropriate size can be created, the genders file must be read and parsed. no data, no list, bestie πŸ“‚
  • GENDERS_ERR_PARAMETERS β€” an incorrect parameter has been passed in. wrong vibes, wrong argument πŸ’€
  • GENDERS_ERR_NULLPTR β€” a null pointer has been found in the list passed in. 😭
  • GENDERS_ERR_OUTMEM β€” malloc(3) has failed internally, system is out of memory. the machine said "i'm full" πŸ“
  • GENDERS_ERR_MAGIC β€” handle has an incorrect magic number. handle does not point to a genders handle, or handle has been destroyed by genders_handle_destroy(3). it's giving cursed artifact ✨

🌈 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)


and that's the whole page, bestie 🫢 this masterpiece was brought to you by LLNL, dated August 2003 β€” yes, this icon has been serving since 2003 and it still ate πŸ’…βœ¨ mwah, go create some lists responsibly πŸ’–