GENDERS_GETNUMNODES(3)

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

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

okay bestie, so this is from libgenders (that's the manual name, section 3, the library-calls girlies) and it's literally the whole stats squad: genders_getnumnodes, genders_getnumattrs, genders_getmaxattrs, genders_getmaxnodelen, genders_getmaxattrlen, and genders_getmaxvallen. they're the genders statistics routines and they are so useful, no cap.


✨ 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 basically, 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. like, they're all reading the same file, just clocking different things about it πŸ’…

  • genders_getnumnodes() β€” returns the number of nodes stored in the genders file. that's the node count, periodt.
  • 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 here's the vibe check on why you'd ever want these: in general, all six of them get used so a programmer can dynamically allocate a proper amount of memory to store genders file information in. like yes, you're asking for the sizes before you build the container. it's giving responsible memory management and honestly we're obsessed 😌✨


⭐ RETURN VALUES ⭐

on success, 0 is returned. slay.

on error, -1 is returned, and an error code is returned in handle. you can retrieve that error code with genders_errnum(3), and you can get a lil description of what that error code even means with genders_strerror(3). the error codes themselves 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, you can't just pass nothing 😭
  • GENDERS_ERR_NOTLOADED β€” genders_load_data(3) has not been called to load genders data. no data loaded, no stats, that's the rule.
  • GENDERS_ERR_MAGIC β€” handle has an incorrect magic number. this means handle does not point to a genders handle, or handle has been destroyed by genders_handle_destroy(3). rip to that handle πŸͺ¦

πŸ“ FILES πŸ“

  • /usr/include/genders.h

🌈 SEE ALSO 🌈

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


ngl this whole page is a gift if you're out here trying to allocate exactly the right amount of memory instead of guessing. read the stats first, queen. πŸ‘‘

sign-off time ✨ this icon of a manpage came to you from LLNL, dated August 2003 β€” yes she's vintage and she's still serving πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from