GENDERS_NODELIST_CREATE(3)

πŸ’– NAME πŸ’–

okay bestie, gather round, because this is GENDERS_NODELIST_CREATE(3) from the LIBGENDERS era and it's literally the list-handling girlies πŸ’…

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 ✨


✨ 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 here's the tea β˜• β€” 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, fr fr β€” so you can hand them off to genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3). 🫢

genders_nodelist_create(), genders_attrlist_create(), and genders_vallist_create() build you 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 just got created. And here's the part that slays: the created lists are guaranteed to store all the node, attribute, and value info coming back from genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3). no overflow, no stress, periodt πŸ’…

genders_nodelist_clear(), genders_attrlist_clear(), and genders_vallist_clear() wipe out whatever info is sitting in the lists pointed to by nodelist, attrlist, and vallist respectively. Bestie, listen β€” you do not have to call these after their respective create functions. πŸ™ˆ You only call them after the list has been used in genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3), and the programmer wants to re-use that list. that's it, that's the whole vibe.

genders_nodelist_destroy(), genders_attrlist_destroy(), and genders_vallist_destroy() destroy the lists pointed to by nodelist, attrlist, and vallist respectively. bye bye πŸ‘‹

lowkey important note: if no attributes or values are listed in the genders database, 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.

πŸ”₯ RETURN VALUES πŸ”₯

On success, genders_nodelist_create(), genders_attrlist_create(), and genders_vallist_create() return the number of elements the created list can store πŸ‘‘

On success, genders_nodelist_clear(), genders_attrlist_clear(), genders_vallist_clear(), genders_nodelist_destroy(), genders_attrlist_destroy(), and genders_vallist_destroy() return 0.

On error, -1 is returned, and an error code is returned in handle. 😭 That error code can be retrieved via genders_errnum(3), and a description of it can be retrieved via genders_strerror(3). Error codes are defined in genders.h.


πŸ’€ ERRORS πŸ’€

  • GENDERS_ERR_NULLHANDLE β€” the handle parameter is NULL. babe. the genders handle must be created with genders_handle_create(3). no handle, no service πŸ™…
  • 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. like, we can't size anything if we haven't read anything, iykyk πŸ“–
  • GENDERS_ERR_PARAMETERS β€” an incorrect parameter has been passed in. 🚩
  • 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 is struggling 😭
  • 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). fake handle, not iconic ✨

πŸ“ 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 one came to you straight from LLNL, August 2003 β€” the LIBGENDERS girlies have been at this since way before you were born, and they ate. go create some lists, clear them when you're done reusing them, destroy them when you're finished, and drink water. mwah πŸ’–πŸ¦‹βœ¨