GENDERS_NODELIST_CREATE(3)

πŸ’– GENDERS_NODELIST_CREATE(3) πŸ’–

okay bestie, welcome to the libgenders list-management corner of the manual. this one's page three, section three, and it's literally all about making lists, wiping lists, and yeeting lists into the void. it's giving housekeeping but make it iconic. 🧹✨


🌸 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 here's the tea 🍡. these nine functions β€” 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 use to create, clear, and destroy lists. and by "lists" we mean arrays of strings, bestie. arrays. of. strings. πŸ’€ they're built to be used 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 to the created list. and the 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, no drama. πŸ‘‘

🧼 the clear girlies

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 listen β€” you do not have to call them after their respective create functions, okay? they only need to be called after they've been used in genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3), and the programmer wants to re-use the list. that's the whole vibe check. βœ…

πŸ’€ the destroy girlies

genders_nodelist_destroy(), genders_attrlist_destroy(), and genders_vallist_destroy() destroy the lists pointed to by nodelist, attrlist, and vallist respectively. gone. bye. 🫢

⚠️ okay important plot twist: 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. so don't go dereferencing it expecting a glow-up, bestie. 😭

πŸ”₯ 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(), and genders_vallist_destroy() return 0. clean. immaculate. ✨

on error, -1 is returned, and an error code is returned in handle. you can retrieve that error code via genders_errnum(3), and a description of the error code via genders_strerror(3). error codes are defined in genders.h. πŸ“–


πŸ’… ERRORS πŸ’…

  • GENDERS_ERR_NULLHANDLE β€” the handle parameter is NULL. 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. you gotta read the file first, babe. πŸ“‚
  • GENDERS_ERR_PARAMETERS β€” an incorrect parameter has been passed in. bestie what did you do. πŸ™ˆ
  • 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). magic's gone, girl. ✨πŸͺ„

πŸ“ 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 from LLNL and it's dated August 2003 β€” yeah, vintage, but she still ate. πŸ’œ go forth and manage your lists responsibly. mwah. πŸ«ΆπŸŽ€πŸ’–