GENDERS_GETNUMNODES(3)

πŸ“¦
version 1.28.1~^20231119git27b915d Β· 5 versions
, in epel 10, fedora 43, fedora 44

πŸ’– GENDERS_GETNUMNODES πŸ’–

ok so bestie, this is a page from LIBGENDERS β€” the genders_getnumnodes(3) family of stats routines. yes we're doing math today but it's the cute kind i promise πŸŽ€


✨ NAME ✨

genders_getnumnodes, genders_getnumattrs, genders_getmaxattrs, genders_getmaxnodelen, genders_getmaxattrlen, genders_getmaxvallen β€” the genders statistics routines 🌈 (basically the girls who count things for you)


🌸 SYNOPSIS 🌸

#include <genders.h>

int genders_getnumnodes(genders_t handle);

int genders_getnumattrs(genders_t handle);

int genders_getmaxattrs(genders_t handle);

int genders_getmaxnodelen(genders_t handle);

int genders_getmaxattrlen(genders_t handle);

int genders_getmaxvallen(genders_t handle);

πŸ¦‹ DESCRIPTION πŸ¦‹

ok so like, all six of these girls β€” genders_getnumnodes(), genders_getnumattrs(), genders_getmaxattrs(), genders_getmaxnodelen(), genders_getmaxattrlen(), and genders_getmaxvallen() β€” pull up statistics about the genders file that's associated with handle. that's the whole job. they're gossipy like that πŸ’…

  • genders_getnumnodes() β€” returns the number of nodes stored in the genders file.
  • genders_getnumattrs() β€” returns the number of attributes listed in the genders file.
  • genders_getmaxattrs() β€” returns the maximum number of attributes listed with a node in the genders file.
  • genders_getmaxnodelen() β€” returns the maximum length of any node listed in the genders file.
  • genders_getmaxattrlen() β€” returns the maximum length of any attribute listed in the genders file.
  • genders_getmaxvallen() β€” returns the maximum length of any attribute value listed in the genders file.

and why do we care, bestie? because in general, these six are used so a programmer can dynamically allocate a proper amount of memory to store genders file information in. no cap, that's the entire plot. you count first so you don't over- or under-allocate. it's giving ✨responsible memory management✨ πŸ‘‘


πŸŽ€ RETURN VALUES πŸŽ€

  • on success, 0 is returned. 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 πŸ’€

not me listing every possible way this can go wrong 😭 but like, fr fr, know your enemies.
  • GENDERS_ERR_NULLHANDLE β€” the handle parameter is NULL. the genders handle must be created with genders_handle_create(3). like bestie you gotta make the handle first, it doesn't just appear 🫢
  • GENDERS_ERR_NOTLOADED β€” genders_load_data(3) has not been called to load genders data. no data loaded, no stats, sorry babe.
  • 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 vibe check failed, the magic is gone, it's over πŸ’€

πŸ“ FILES πŸ“

  • /usr/include/genders.h

🌈 SEE ALSO 🌈


ok that's the whole page bestie, you ate it up πŸ’…βœ¨

this icon of a manpage was brought to you by LLNL, dated August 2003 β€” yes she's vintage, yes she still serves πŸŽ€πŸ‘‘

πŸ“¦ where this page comes from