dbh_macros(3)

πŸ“¦ version 5.0.22, in fedora 43, fedora 44

✨ dbh_macros β€” the manual page, but make it cute ✨

okay bestie, you're in the DBHashTables Programmers' Manual section 3, and this is dbh_macros(3). yes the title of the page and the manual name are the same-ish, we're folding that in, we're moving on. πŸ’…


πŸŽ€ NAME

dbh_macros β€” the macros available in dbh, and yes they're giving convenience, they're giving shortcuts, they're giving "I don't wanna touch the struct directly" energy.


πŸ¦‹ SYNOPSIS

#include <dbh.h>

unsigned char DBH_KEYLENGTH (DBHashTable * dbh);
FILE_POINTER DBH_RECORD_SIZE (DBHashTable * dbh);
void *DBH_KEY (DBHashTable * dbh);
void *DBH_DATA (DBHashTable * dbh);
FILE_POINTER DBH_ERASED_SPACE (DBHashTable * dbh);
FILE_POINTER DBH_DATA_SPACE (DBHashTable * dbh);
FILE_POINTER DBH_TOTAL_SPACE (DBHashTable * dbh);
FILE_POINTER DBH_FORMAT_SPACE (DBHashTable * dbh);
FILE_POINTER DBH_RECORDS (DBHashTable * dbh);
FILE_POINTER DBH_MAXIMUM_RECORD_SIZE (DBHashTable * dbh);
char *DBH_PATH (DBHashTable * dbh);

like. look at that list. eleven of them. all iconic, all just vibing with a DBHashTable * dbh and nothing else. 🌸


πŸ’– DESCRIPTION

These are the convenience macros, bestie β€” they reach into a DBHashTable structure and pull out the elements for you so you don't have to go digging around in there yourself. lowkey the nicest thing anyone's ever done for us.


🌟 DBH_KEYLENGTH ()

returns the keylenth in bytes that's associated to the DBHashTable. (yes, the manual says "keylenth", we're keeping it, it's part of the lore now πŸ™ˆ)

and here's the thing: that value is fixed at the moment the DBHashTable is created with dbh_create. so no, it does not change later. it's locked in. periodt.


🌟 DBH_RECORD_SIZE ()

returns the size of the current record that's loaded up in memory.

⚠️ but if no record has been loaded? then the return value is not defined. not "zero", not "probably fine", not "eh it'll work" β€” not defined. so maybe don't. 😭

🌟 DBH_KEY ()

hands you a pointer to the current DBHashTable key area. go forth. 🫢


🌟 DBH_DATA ()

hands you a pointer to the current DBHashTable data area. the data one. not the key one. we love a distinction.


🌟 DBH_ERASED_SPACE ()

returns how many bytes are taken up by erased data in the DBHashTable. the ghost data. the leftovers. πŸ’€


🌟 DBH_DATA_SPACE ()

returns how many bytes are taken up by valid data in the DBHashTable. the real ones. the main characters. πŸ‘‘


🌟 DBH_TOTAL_SPACE ()

returns the total amount of bytes taken up by the DBHashTable. everything. all of it. the whole vibe check. πŸ”₯


🌟 DBH_FORMAT_SPACE ()

returns the total amount of bytes taken up by the format of the DBHashTable. the structure itself, not the contents. it's giving scaffolding. ✨


🌟 DBH_RECORDS ()

returns the number of records in the DBHashTable. just a count. a little census. adorable. πŸ“


🌟 DBH_MAXIMUM_RECORD_SIZE ()

returns the maximum allocated space for data in the current DBHashTable record. so like, the ceiling. the cap. the limit. πŸ’œ


🌟 DBH_PATH ()

returns a pointer to a string containing the path to the current DBHashTable. it knows where it lives. self-aware king. 🌈


🧚 SEE ALSO

  • dbh (0)

🌸 Author

Edscott Wilson Garcia <edscott@xfce.org>


okay and that's the whole page, no cap β€” this was DBHashTables, DBH, dbh_macros(3). thanks for coming to my ted talk, go write some hash tables bestie πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from