GENDERS_NODELIST_CREATE(3)

✨ NAME ✨

okay so bestie, meet the whole lil squad of 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, and genders_vallist_destroy β€” aka the list create, clear, and destroy routines, and yes they are literally the backbone of everything 🫢


🌸 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, 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, no cap β€” for use with genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3). the whole glow-up pipeline ✨

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 respectively get set to point at the created list, main character energy πŸŽ€ and the created lists are guaranteed to store all the node, attribute, and value information returned from genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3). like, fully guaranteed, that's the whole vibe 🫢

genders_nodelist_clear(), genders_attrlist_clear(), and genders_vallist_clear() clear whatever info is stored in the lists pointed to by nodelist, attrlist, and vallist respectively. and here's the thing β€” you do not have to call them after their respective create functions. nope. they only have to be called after the lists are used in genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3), and the programmer wishes to re-use the list. re-use, recycle, sustainable queen 🌈

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

okay important side note: if no attributes or values are listed in the genders database, all of the attrlist and vallist functions will do nothing. nothing at all. and the pointer passed into genders_attrlist_create() and genders_vallist_create() will not be set. so don't go assuming it got set, because it didn't πŸ™ˆ

⭐ RETURN VALUES ⭐

on success, genders_nodelist_create(), genders_attrlist_create(), and genders_vallist_create() return the number of elements the created list can store πŸ”₯ like, actual useful info, we love that.

on success, genders_nodelist_clear(), genders_attrlist_clear(), genders_vallist_clear() genders_nodelist_destroy(), genders_attrlist_destroy(), genders_vallist_destroy() return 0. slay.

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


πŸ‘‘ ERRORS πŸ‘‘

  • GENDERS_ERR_NULLHANDLE β€” the handle parameter is NULL. like, you gotta make that genders handle with genders_handle_create(3) first bestie, no skipping steps πŸ’…
  • 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. can't size a list off vibes alone 😭
  • GENDERS_ERR_PARAMETERS β€” an incorrect parameter has been passed in. wrong vibe check, failed 🚫
  • GENDERS_ERR_NULLPTR β€” a null pointer has been found in the list passed in. sneaky lil null in the list, not it 🫠
  • GENDERS_ERR_OUTMEM β€” malloc(3) has failed internally, system is out of memory. the system ate too much and now it's full, tragic πŸ’€
  • 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). wrong magic, fake handle, we can tell ✨

πŸŽ€ 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, go forth and manage your lists responsibly πŸ’– this one's from LLNL, dated August 2003, and it lives in the LIBGENDERS manual, section 3 β€” iconic since day one, periodt πŸ‘‘πŸŒΈ