GENDERS_GETNUMNODES(3)

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

✨ GENDERS_GETNUMNODES ✨

okay bestie, so this is a libgenders manual page β€” third section, the library one, iykyk πŸ’… β€” and it's literally all about the little stat-checker functions that tell you how big stuff is in your genders file before you go allocating memory like a menace.


🌸 NAME 🌸

genders_getnumnodes, genders_getnumattrs, genders_getmaxattrs, genders_getmaxnodelen, genders_getmaxattrlen, genders_getmaxvallen β€” the genders statistics routines, aka your little squad of numbers-girlies πŸŽ€


πŸ¦‹ 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. 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 vibe. 🌈

  • genders_getnumnodes() β€” returns the number of nodes stored in the genders file. how many nodes we got, fr fr. πŸ‘‘
  • genders_getnumattrs() β€” returns the number of attributes listed in the genders file. the attribute count, no cap. ✨
  • genders_getmaxattrs() β€” returns the maximum number of attributes listed with a node in the genders file. like, which node is the most extra? that number. πŸ’…
  • genders_getmaxnodelen() β€” returns the maximum length of any node listed in the genders file. longest node name gets the crown. πŸ‘‘
  • genders_getmaxattrlen() β€” returns the maximum length of any attribute listed in the genders file. longest attribute, periodt. 🌸
  • genders_getmaxvallen() β€” returns the maximum length of any attribute value listed in the genders file. yeah, the value one, not the attribute one, don't mix them up bestie 😭

and like, why do we even care? because genders_getnumnodes(), genders_getnumattrs(), genders_getmaxattrs(), genders_getmaxnodelen(), genders_getmaxattrlen(), and genders_getmaxvallen() are generally used so that a programmer can dynamically allocate a proper amount of memory to store genders file information in. that's it. that's the whole point. no more guessing how much malloc to do, we're being responsible with our memory for once 🫢


πŸ”₯ 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 πŸ’€

  • GENDERS_ERR_NULLHANDLE β€” the handle parameter is NULL. the genders handle must be created with genders_handle_create(3). you can't just pass in nothing and expect the girlies to work, bestie πŸ™ˆ
  • GENDERS_ERR_NOTLOADED β€” genders_load_data(3) has not been called to load genders data. there's literally nothing loaded. nothing. empty. void. 😭
  • 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 magic is gone, and not in a cute way ✨

πŸŽ€ FILES πŸŽ€

  • /usr/include/genders.h

🌟 SEE ALSO 🌟

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


ngl if you're reading this because you tried to allocate memory based on vibes instead of calling these first, that's so real of you and also please stop πŸ’œ

this lil page is brought to you by LLNL, dated August 2003 β€” old enough to be your parent but still serving absolute icon behavior πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from