aboutsummaryrefslogtreecommitdiff
path: root/c_implementation/src/ak_fs_mt.c
blob: 3f638e6c23624f9be0c3284ea875a24e212df88c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h>
#include <libakfs.h>
#include <libaklog.h>
#include <stdlib.h>

bool ak_fs_mt_branch_is_null(mt_branch* node)
{
    if (
            ak_fs_sha512sum_is_null(&node->root) &&
            ak_fs_sha512sum_is_null(&node->head) &&
            ak_fs_sha512sum_is_null(&node->tail)
       )
    {
        return true;
    }
    return false;
}

bool ak_fs_mt_branch_compare(mt_branch *a, mt_branch *b)
{
    if (
            ak_fs_sha512sum_compare(&a->root, &b->root) &&
            ak_fs_sha512sum_compare(&a->head, &b->head) &&
            ak_fs_sha512sum_compare(&a->tail, &b->tail)
       )
    {
        return true;
    }
    return false;
}

void ak_fs_mt_branch_print(mt_branch *n)
{
    printf("r: %s\n", ak_fs_sha512sum_struct_read_as_string(&n->root));
    printf("h: %s\n", ak_fs_sha512sum_struct_read_as_string(&n->head));
    printf("t: %s\n", ak_fs_sha512sum_struct_read_as_string(&n->tail));
}