GENDERS_GETNUMNODES(3)

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

πŸ’– GENDERS_GETNUMNODES(3) β€” the libgenders stats girlies πŸ’–

okay so bestie, we're in the libgenders section of the manual (section 3, the library one, iykyk) and this page is literally just about counting things. no drama, no plot twist, just numbers. let's go ✨


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

like look at them. six little functions. all of them take a handle and all of them hand you back an int. no cap πŸ’…


πŸ‘‘ 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. they're the friend who keeps track of everyone's stats for you 🫢

here's the breakdown, one by one:

  • 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. so like, the most extra node in there. main character behavior, honestly.
  • genders_getmaxnodelen() β€” returns the maximum length of any node listed in the genders file. longest node name, 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. (values!! not attributes!! don't mix them up bestie 😭)

and why do you even care, you ask? so valid of you. in general, these six functions exist so a programmer can dynamically allocate a proper amount of memory to store genders file information in. like, you ask how big it's gonna be before you build the container. iconic. that's the whole point. 🧚


✨ 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). also the error codes are defined in genders.h, so that's where you go looking if you're nosy (affectionate). πŸ‘€


πŸ’€ ERRORS πŸ’€

here's the trio of ways this can go wrong. vibe check:

  • GENDERS_ERR_NULLHANDLE β€” the handle parameter is NULL. the genders handle has to be created with genders_handle_create(3) first, bestie, you can't just show up with nothing πŸ™ˆ
  • GENDERS_ERR_NOTLOADED β€” genders_load_data(3) has not been called to load genders data. no data, no stats. that's just the rules. 😀
  • GENDERS_ERR_MAGIC β€” handle has an incorrect magic number. this means either handle doesn't point to a genders handle, or handle has been destroyed by genders_handle_destroy(3). it's giving ghost of a handle that no longer exists πŸ’€βœ¨

πŸ“ FILES πŸ“

  • /usr/include/genders.h

(the lore lives here fr fr)


🌟 SEE ALSO 🌟

go read those next, they're all connected, it's a whole cinematic universe 🌈


and that's the page!! brought to you by LLNL, dated August 2003, part of the LIBGENDERS manual, and like... the fact that these stats routines have been quietly serving since 2003? obsessed. πŸ’…πŸ«Ά counting nodes and slaying since the early aughts, no cap. mwah πŸ’–

πŸ“¦ where this page comes from