GENDERS_NODELIST_CREATE(3)
π GENDERS_NODELIST_CREATE π
okay bestie, so this is a whole family of routines from libgenders β the list create / clear / destroy girlies. Nine functions, one manpage, and honestly? they're serving organizational excellence. 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, and genders_vallist_destroy β the list create, clear, and destroy routines π
like, it's giving "we manage arrays of strings so you don't have to." iconic behavior fr fr.
πΈ 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);
notice the triple pointer on the _create ones? yeah. that's because they're handing you back a whole new list. the clear and destroy ones only take a double pointer because the list already exists. the way that C works π
π¦ 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 literally the trio of create / clear / destroy for lists, which are just arrays of strings. you use them with genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3). that's the whole vibe π«Ά
π 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. then nodelist, attrlist, and vallist get set to point at the list that was just created. no cap. π
and bestie, here's the reassuring part: those created lists are guaranteed to store all the node, attribute, and value info that comes back from genders_getnodes(3), genders_getattr(3), and genders_getattr_all(3). so you don't have to stress about overflow, it's sized correctly, periodt.
π§ the clear girlies
genders_nodelist_clear(), genders_attrlist_clear(), and genders_vallist_clear() clear out whatever info is sitting in the lists pointed to by nodelist, attrlist, and vallist respectively.
okay important: you do NOT have to call these after their matching create function. they only have to be called after the list has been used ingenders_getnodes(3),genders_getattr(3), andgenders_getattr_all(3), and the programmer wants to re-use the list. so like, only when you're recycling. reduce reuse slay π
π the destroy girlies
genders_nodelist_destroy(), genders_attrlist_destroy(), and genders_vallist_destroy() destroy the lists pointed to by nodelist, attrlist, and vallist respectively. bye bye list, you served well π«‘
π the "no attributes, no values" situation
if no attributes or values are listed in the genders database, all of the attrlist and vallist functions will do nothing. and listen β the pointer you passed into genders_attrlist_create() and genders_vallist_create() will not be set. not me finding that out the hard way π so vibe check your database first, iykyk.
β RETURN VALUES β
on success, genders_nodelist_create(), genders_attrlist_create(), and genders_vallist_create() return the number of elements the created list can store. yes bestie, it tells you how much room you've got. so thoughtful β¨
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. you can grab that error code with genders_errnum(3), and get a lil description of it with genders_strerror(3). the error codes live in genders.h, so go peek π
π ERRORS π
GENDERS_ERR_NULLHANDLEβ thehandleparameter isNULL. the genders handle has to be created withgenders_handle_create(3)first, bestie, you can't just skip that step πGENDERS_ERR_NOTLOADEDβgenders_load_data(3)hasn't been called to load genders data. like, before lists of the appropriate size can be created, the genders file must be read and parsed. no data, no list. simple as.GENDERS_ERR_PARAMETERSβ an incorrect parameter has been passed in. wrong vibes were sent πGENDERS_ERR_NULLPTRβ a null pointer has been found in the list that was passed in. bestie, there's a hole in your list πGENDERS_ERR_OUTMEMβmalloc(3)failed internally because the system is out of memory. it's not you, it's the RAM πGENDERS_ERR_MAGICβhandlehas an incorrect magic number. meaninghandledoesn't point to a genders handle, orhandlehas already been destroyed bygenders_handle_destroy(3). rip to that handle, it's gone πͺ¦β¨
π 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)
okay that's the whole page bestie, go forth and manage your lists responsibly π this masterpiece came to you from LLNL, dated August 2003 β yes she's vintage, and yes she still ate. mwah ππ π¦
π¦ where this page comes from
- epel 10: libgenders-devel 1.28.1~^20231119git27b915d-5.el10_2 Β· GPL-2.0-only
- fedora 43: libgenders-devel 1.28.1~^20231119git27b915d-5.fc43 Β· GPL-2.0-only
- fedora 43: libgenders-devel 1.28.1~^20231119git27b915d-5.fc43 Β· GPL-2.0-only
- fedora 44: libgenders-devel 1.28.1~^20231119git27b915d-6.fc44 Β· GPL-2.0-only
- fedora 44: libgenders-devel 1.28.1~^20231119git27b915d-6.fc44 Β· GPL-2.0-only
- opensuse-leap 16.0: genders-devel 1.32-bp160.1.11 Β· GPL-2.0-or-later
- opensuse-leap 16.0: genders-devel 1.32-bp160.1.11 Β· GPL-2.0-or-later
- opensuse-leap 16.0: genders-devel 1.32-bp160.1.11 Β· GPL-2.0-or-later
- opensuse-leap 16.0: genders-devel 1.32-bp160.1.11 Β· GPL-2.0-or-later
- Copyright (C) 2007-2019 Lawrence Livermore National Security, LLC
- Copyright (C) 2001-2007 The Regents of the University of California
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms