GENDERS_NODELIST_CREATE(3)

πŸ’– GENDERS_NODELIST_CREATE πŸ’–

okay bestie, welcome to libgenders(3) β€” the section of the manual where we talk about making lists, emptying lists, and yeeting lists into the void. no cap, this page is literally just the create / clear / destroy trio, times three. let's get into it πŸŽ€


✨ 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 whole job πŸ’…


🌸 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 when you want to create, clear, and destroy lists β€” and by "lists" we mean arrays of strings, bestie β€” for use with genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3). they're a whole little friend group 🀝

genders_nodelist_create(), genders_attrlist_create(), and genders_vallist_create() creates a list with minimum size to store nodes, attributes, and attribute values respectively. (yes, the manpage says "creates", we're keeping it, it's iconic in its own way πŸ’€) nodelist, attrlist, and vallist are respectively set to point to the created list. 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). no overflow, no panic, we're safe ✨

genders_nodelist_clear(), genders_attrlist_clear(), and genders_vallist_clear() clear any information stored in the lists pointed to by nodelist, attrlist, and vallist respectively. important vibe check: they do not have be called after their respective create functions. they only have to be called after they are used in genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3), and the programmer wishes to re-use the list. so like β€” reuse era only 🫢

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

⚠️ plot twist: 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 fine, because it is not 🚩

πŸ”₯ RETURN VALUES πŸ”₯

on success, genders_nodelist_create(), genders_attrlist_create(), and genders_vallist_create() return the number of elements the created list can store. cute, informative, slay πŸ’–

on success, genders_nodelist_clear(), genders_attrlist_clear(), genders_vallist_clear(), genders_nodelist_destroy(), genders_attrlist_destroy(), genders_vallist_destroy() return 0. (the manpage forgot a comma in that list, we are not fixing it, we are simply noticing it πŸ™ˆ)

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. write that down πŸ“


πŸ’€ ERRORS πŸ’€

  • GENDERS_ERR_NULLHANDLE β€” the handle parameter is NULL. the genders handle must be created with genders_handle_create(3). bestie you can't text nobody with no phone 😭
  • 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. you gotta read the lore first, fr fr πŸ“–
  • GENDERS_ERR_PARAMETERS β€” an incorrect parameter has been passed in. not the vibe 🚫
  • 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 going through it πŸ’€
  • 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). the magic is gone, and that's lowkey tragic πŸͺ„βœ¨

πŸŽ€ 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 page, bestie!! this one came from LLNL, dated August 2003, and it's living in the LIBGENDERS section β€” so if you see it in the wild, that's the source and the date right there. historic. iconic. periodt πŸ’…πŸ’–βœ¨