dbh_load(3)

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

✨ NAME ✨

okay so bestie, this is dbh_load, dbh_load_address, dbh_load_parent, and dbh_load_child β€” they load a DBHashTable record to memory πŸ’– that's literally it, that's the whole job.

it's from the DBHashTables Programmers' Manual, btw. πŸ’…


🌸 SYNOPSIS 🌸

#include <dbh.h>

FILE_POINTER dbh_load (DBHashTable *dbh);
unsigned char dbh_load_address (DBHashTable *dbh,
FILE_POINTERcurrentseek);
FILE_POINTER dbh_load_parent (DBHashTable *dbh);
FILE_POINTER dbh_load_child (DBHashTable *dbh, unsigned char key_index);

no cap, that's the whole API. four little guys. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so dbh_load will load a record using the currently set key. and here's the lil plot twist bestie β€” it will also load erased values, except that it will return 0. so like, it's not gatekeeping the deleted ones, but it's also telling you "yeah this one's a ghost" by returning 0. iconic behavior tbh πŸ‘»

dbh_load_address will load a record from the hash table directly from byte offset currentseek. no key needed, you just point at the byte and go. 🎯

dbh_load_parent will load the parent of the currently loaded record. family reunion energy. 🧚

dbh_load_child will load the first child of the currently loaded record, on the branch identified by key_index. and okay listen β€” since the number of childs (or branches) of each record is variable, this may be tricky. ⚠️

here's the tea on that, fr fr:

  • Top level records have DBH_KEYLENGTH branches.
  • Lower level records have less.
  • Each byte of a key represents a branch on top level records.

so yeah. count your branches before you go grabbing at key_index, bestie. πŸ’€


πŸ”₯ RETURN VALUE πŸ”₯

  • dbh_load_address will return 0 on error, and number of branches otherwise.
  • dbh_load, dbh_load_parent, and dbh_load_child will return 0 on error, and the byte offset of the loaded record otherwise.
bestie reminder: 0 is the error signal here, so always vibe check that return value before you use it. periodt. βœ‹

πŸ‘‘ SEE ALSO πŸ‘‘

  • dbh (0)
  • dbh_update (3)
  • dbh_macros (3)

πŸ’œ Author

Edscott Wilson Garcia <edscott@xfce.org> πŸŽ€


and that's the whole page, bestie! this one lives in the DBH section of the DBHashTables manual, and you can find it filed under dbh_load(3). go forth and load some records, you absolute main character πŸŒˆβ­πŸ’–

πŸ“¦ where this page comes from