GENDERS_NODELIST_CREATE(3)

๐Ÿ’– GENDERS_NODELIST_CREATE ๐Ÿ’–

okay bestie, so this is the LIBGENDERS page for the list create / clear / destroy girlies โœจ โ€” yes, the whole squad is here, genders_nodelist_create and all her sisters. Sit down, grab a boba, we're doing list management. ๐ŸŽ€


๐ŸŒธ 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. the whole little family. ๐Ÿซถ


โœจ 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. these nine functions? they're the ones that make, wipe, and yeet lists โ€” and a "list" here is literally just an array of strings, no cap. you use them with genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3). it's giving โœจplumbingโœจ but the good kind. ๐Ÿ’…

creating โ€” genders_nodelist_create(), genders_attrlist_create(), and genders_vallist_create() each create a list with the minimum size needed to store nodes, attributes, and attribute values respectively. nodelist, attrlist, and vallist are respectively set to point to the created list. and here's the slay part: 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). guaranteed. iconic. ๐Ÿ‘‘

clearing โ€” 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. do you have to call them right after the create functions? no bestie. ๐Ÿšซ they only have to be called after the list was used in genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3), and the programmer wishes to re-use the list. that's it, that's the rule.

destroying โ€” genders_nodelist_destroy(), genders_attrlist_destroy(), and genders_vallist_destroy() destroy the lists pointed to by nodelist, attrlist, and vallist respectively. closure. ๐Ÿงš

โš ๏ธ and now the plot twist, and it's a big one: if no attributes or values are listed in the genders database, all of the attrlist and vallist functions will do nothing. like, nothing nothing. and the pointer you passed into genders_attrlist_create() and genders_vallist_create() will not be set. so don't be out here dereferencing it and acting surprised, i'm begging ๐Ÿ˜ญ

๐ŸŒˆ RETURN VALUES ๐ŸŒˆ

on success, genders_nodelist_create(), genders_attrlist_create(), and genders_vallist_create() return the number of elements the created list can store. so you know exactly how much room you've got, which is lowkey thoughtful of them. ๐Ÿ’–

on success, genders_nodelist_clear(), genders_attrlist_clear(), genders_vallist_clear(), genders_nodelist_destroy(), genders_attrlist_destroy(), and genders_vallist_destroy() return 0. zero. nothing. clean. โœจ

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 it with genders_strerror(3). and where do the error codes live? in genders.h. periodt. ๐Ÿ“š


๐Ÿ’€ ERRORS ๐Ÿ’€

  • GENDERS_ERR_NULLHANDLE โ€” the handle parameter is NULL. the genders handle must be created with genders_handle_create(3). you cannot run this on vibes alone bestie, you need an actual handle ๐Ÿ™ˆ
  • 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, that's just how it is ๐Ÿ“
  • GENDERS_ERR_PARAMETERS โ€” an incorrect parameter has been passed in. something's wrong with what you handed over ๐Ÿ˜ญ
  • GENDERS_ERR_NULLPTR โ€” a null pointer has been found in the list passed in. girl. there's a NULL in the list ๐Ÿ’€
  • GENDERS_ERR_OUTMEM โ€” malloc(3) has failed internally, system is out of memory. the machine is tired. it's not you, it's the RAM. ๐Ÿ˜”
  • 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 โœจnotโœจ there, and you cannot fake it ๐Ÿ”ฎ

๐ŸŽ€ FILES ๐ŸŽ€

  • /usr/include/genders.h

๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘


and that's the whole page bestie, no notes ๐Ÿ’… this masterpiece was brought to you by LLNL, dated August 2003 (yes it's older than us, it ate and left no crumbs), sitting in the LIBGENDERS collection. go forth and manage your lists responsibly. mwah ๐Ÿซถ๐Ÿ’–โœจ