MTREE_INIT(3)

NAME
mtree_init, mtree_free - initialize and free a merkle tree

LIBRARY
Librecast library (liblibrecast, -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.

DESCRIPTION
The tree_init function initializes the merkle tree structure tree with base data size sz. sz is the size in bytes of the base file or data which will be used to build the tree by calling mtree_build(3).

RETURN VALUE
mtree_init() returns zero on success. On error, -1 is returned, and errno is set to indicate the error.

The mtree_free() function returns no value, and preserves errno.

ERRORS

ENOMEM
    Not enough space/cannot allocate memory (POSIX.1-2001).

SEE ALSO
mdex_get(3), mdex_put(3), mdex_del(3)