aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/cc/sym.c
blob: ef40bcee79d3cfb5779b8c6996e0ae3e49d43c22 (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
#include "cc.h"

#include <libn/macro/map.h>

#define PTR_HASH(p)        (uintptr)(p)
#define PTR_EQUAL(p1, p2) ((uintptr)(p1) == (uintptr)(p2))

#if 0
struct SymTab
{
    MAP_STRUCT_BODY(string, Sym*);
};

Sym*
getsym(SymTab *tab, string key)
{
    MAP_GET(tab, key, PTR_HASH, PTR_EQUAL, nil);
}

static
int
moresymtab(SymTab *tab, int n)
{
    MAP_GROW(tab, string, Sym*, n, PTR_HASH);
}

int
putsym(SymTab *tab, Sym *sym, error *err)
{
    MAP_PUT(tab, sym->name, sym, PTR_HASH, PTR_EQUAL, moresymtab, err);
}
#endif