MTREE_INIT(3)
NAME β¨
mtree_init, mtree_free β the glow-up and the goodbye for a merkle tree π
LIBRARY πΈ
Librecast library (that's liblibrecast, bestie, you link it with -llibrecast) π
SYNOPSIS π¦
#include <librecast/mtree.h>
int mtree_init(mtree_t *tree, size_t sz);
void mtree_free(mtree_t *tree);
Compile and link with -llibrecast. Periodt. π
DESCRIPTION π
okay so listen. mtree_init() sets up your merkle tree β the struct you pass in as tree β and gives it a base data size of sz. And what is sz, you ask? It's literally the size, in bytes, of the base file or data that's gonna get built into the tree later when you call mtree_build(3). So like, this is the pre-game. The setup era. The getting-ready-with-me. π
Then there's mtree_free(), which does the exact opposite vibe β it frees that tree. Cleanup queen. No drama, no leftover memory lying around. π
β¨
RETURN VALUE π
mtree_init() comes back with zero when everything slayed. If it doesn't go well? You get -1 returned, and errno gets set to spill the tea about what actually went wrong. π
mtree_free() returns no value at all β it's a void, she doesn't do receipts β and it preserves errno. So whatever errno was before, it's still that after. Iconic, honestly. π«Ά
ERRORS π
ENOMEMβ Not enough space / cannot allocate memory (POSIX.1-2001). The memory said no. π
SEE ALSO π₯
mdex_get(3), mdex_put(3), mdex_del(3)
and that's the whole page, bestie!! this lil' guide is from the Librecast crew, dated 2023-06-20, and yeah β it's MTREE_INIT(3) in the Librecast Programmer's Manual. no cap. mwah πππ¦
π¦ where this page comes from
- debian trixie: liblibrecast-dev 0.9.1-1 Β· GPL-2.0-only OR GPL-3.0-only
- nixos 26.05: librecast 0.11.2
- nixpkgs unstable: librecast 0.11.2
- ubuntu noble: liblibrecast-dev 0.8.0-1.1build1 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu questing: liblibrecast-dev 0.9.1-1
- ubuntu resolute: liblibrecast-dev 0.11.2-2 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu stonking: liblibrecast-dev 0.11.2-2build1 Β· GPL-2.0-only OR GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms