GENDERS_GETNUMNODES(3)

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

πŸ’– GENDERS_GETNUMNODES(3) πŸ’–

okay bestie, welcome to the libgenders corner of the manpage-verse ✨ this one's all about the ✨stats✨ routines β€” the lil squad of functions that peek at your genders file and tell you how big everything is so you can malloc like a responsible main character. no cap, this is the "measure twice, cut once" of genders. πŸŽ€


🌸 NAME 🌸

genders_getnumnodes, genders_getnumattrs, genders_getmaxattrs, genders_getmaxnodelen, genders_getmaxattrlen, genders_getmaxvallen β€” the genders statistics routines πŸ’…


✨ 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 πŸ¦‹

so like. all six of these β€” genders_getnumnodes(), genders_getnumattrs(), genders_getmaxattrs(), genders_getmaxnodelen(), genders_getmaxattrlen(), and genders_getmaxvallen() β€” are here to hand you statistics about the genders file that's associated with handle. that's the whole vibe. πŸ“Š

here's the breakdown, one by one, no gatekeeping:

  • genders_getnumnodes() β€” returns the number of nodes stored in the genders file. how many besties are in the group chat, essentially. πŸ‘‘
  • genders_getnumattrs() β€” returns the number of attributes listed in the genders file. all the labels, all the tags, all the personality traits fr fr. 🏷️
  • genders_getmaxattrs() β€” returns the maximum number of attributes listed with a node in the genders file. i.e. which node is the most extra. (affectionate.) πŸ’…
  • genders_getmaxnodelen() β€” returns the maximum length of any node listed in the genders file. longest name in the roster, periodt. πŸ“
  • 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. the value field really said "i'm the main character". ✨

and here's why you'd ever care, bestie: in general, genders_getnumnodes(), genders_getnumattrs(), genders_getmaxattrs(), genders_getmaxnodelen(), genders_getmaxattrlen(), and genders_getmaxvallen() exist so a programmer can dynamically allocate a proper amount of memory to store genders file information in. that's it. that's the flex. measure first, allocate after, no buffer overflows in this household. 🫢


πŸ”₯ RETURN VALUES πŸ”₯

  • on success, 0 is returned. slay. βœ…
  • 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 themselves are defined in genders.h. iykyk. πŸ“–


😭 ERRORS 😭

  • GENDERS_ERR_NULLHANDLE β€” the handle parameter is NULL. the genders handle has to be created with genders_handle_create(3). you can't skip that step, babe, it's giving "no handle, no service". πŸ™ˆ
  • GENDERS_ERR_NOTLOADED β€” genders_load_data(3) has not been called to load genders data. the data is literally not there yet, bestie, you gotta load it first. ⭐
  • GENDERS_ERR_MAGIC β€” handle has an incorrect magic number. either handle doesn't point to a genders handle, or handle has been destroyed by genders_handle_destroy(3). the magic is gone and we are shook. 🧚

πŸ“ FILES πŸ“

  • /usr/include/genders.h

🌈 SEE ALSO 🌈

libgenders(3), genders_handle_create(3), genders_load_data(3), genders_errnum(3), genders_strerror(3)


lowkey the whole point: get your numbers first, then allocate. trust the process. πŸ’œ

this lil page came to you from LLNL, dated August 2003 β€” yeah she's an icon from the early 2000s and she's still serving πŸ’… mwah, go write some safe code bestie, ily πŸŽ€βœ¨

πŸ“¦ where this page comes from