aboutsummaryrefslogtreecommitdiff
path: root/nodelink.c
blob: d66bed410f7f0c594b00c3e4897fc4729a9c0e71 (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
#include <stdlib.h>
#include <stdio.h>

#include "nodelink.h"
#include "strbst.h"

node* newnode(void) {
    node* new = malloc(sizeof(node));
    new->links = newbst();
    return new;
}

static char* empty(void) {
    char* out = malloc(sizeof(char));
    *out = 0;
    return out;
}

link* newlink(node* to) {
    link* new = malloc(sizeof(link));
    new->desc = empty(); // preferred to NULL because it can be printed
    new->to = to;
    return new;
}