GENDERS_GETNUMNODES(3)

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

πŸ’– GENDERS_GETNUMNODES β€” the genders statistics girlies πŸ’–

okay so bestie, welcome to libgenders's little squad of statistics routines. this page covers genders_getnumnodes, genders_getnumattrs, genders_getmaxattrs, genders_getmaxnodelen, genders_getmaxattrlen, and genders_getmaxvallen β€” six functions whose whole entire job is telling you how big stuff is. they're the "let me check the vibes before I allocate" crew and honestly? iconic. πŸŽ€


✨ 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);

every single one of them takes a genders_t handle and nothing else. low maintenance queens fr fr. πŸ’…


🌸 DESCRIPTION 🌸

so genders_getnumnodes(), genders_getnumattrs(), genders_getmaxattrs(), genders_getmaxnodelen(), genders_getmaxattrlen(), and genders_getmaxvallen() all get statistics about the genders file that's associated with handle. that's the whole vibe. πŸ¦‹

let me break it down one by one, because each one is doing her own lil thing:

  • genders_getnumnodes() β€” returns the number of nodes stored in the genders file. that's it. that's the count. πŸ‘‘
  • 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. like, which node is out here being the most extra? this tells you.
  • 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 like, why do we care? bc in general, genders_getnumnodes(), genders_getnumattrs(), genders_getmaxattrs(), genders_getmaxnodelen(), genders_getmaxattrlen(), and genders_getmaxvallen() are used so a programmer can dynamically allocate a proper amount of memory to store genders file information in. no more guessing, no more vibes-based malloc, we're doing this correctly bestie. 🧚✨


πŸ’œ 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). error codes are defined in genders.h. 😌


πŸ”₯ ERRORS πŸ”₯

  • GENDERS_ERR_NULLHANDLE β€” the handle parameter is NULL. bestie. the genders handle has to be created with genders_handle_create(3) first. no handle, no stats. 😭
  • GENDERS_ERR_NOTLOADED β€” genders_load_data(3) has not been called to load genders data. you gotta load it before you can measure it, that's just the rules. πŸ’€
  • 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). gone. ghosted. βœ¨πŸ™ˆ
fr fr, if you're getting GENDERS_ERR_MAGIC it's giving "you're holding a handle to something that no longer exists" energy. check your lifetimes, bestie.

🌈 FILES 🌈

  • /usr/include/genders.h

⭐ SEE ALSO ⭐

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


okay that's the whole page, you ate that πŸ’… this one came from LLNL, dated August 2003, and it lives in the libgenders manual, section 3. go forth and allocate responsibly, bestie πŸŽ€βœ¨

πŸ“¦ where this page comes from