aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--decl.c1
-rw-r--r--deps.mk10
-rw-r--r--map.c1
-rw-r--r--map.h12
-rw-r--r--qbe.c2
-rw-r--r--scope.c1
-rw-r--r--tree.c1
-rw-r--r--tree.h8
-rw-r--r--util.h25
9 files changed, 30 insertions, 31 deletions
diff --git a/decl.c b/decl.c
index 5576c6e..80d1c0a 100644
--- a/decl.c
+++ b/decl.c
@@ -8,7 +8,6 @@
#include <string.h>
#include "util.h"
#include "cc.h"
-#include "map.h"
static struct list tentativedefns = {&tentativedefns, &tentativedefns};
diff --git a/deps.mk b/deps.mk
index 10e0a12..21ccbb1 100644
--- a/deps.mk
+++ b/deps.mk
@@ -1,18 +1,18 @@
$(objdir)/driver.o: driver.c util.h config.h
$(objdir)/util.o: util.c util.h
-$(objdir)/decl.o: decl.c util.h cc.h map.h
+$(objdir)/decl.o: decl.c util.h cc.h
$(objdir)/eval.o: eval.c util.h cc.h
$(objdir)/expr.o: expr.c util.h cc.h
$(objdir)/init.o: init.c util.h cc.h
$(objdir)/main.o: main.c util.h arg.h cc.h
-$(objdir)/map.o: map.c util.h map.h
+$(objdir)/map.o: map.c util.h
$(objdir)/pp.o: pp.c util.h cc.h
$(objdir)/scan.o: scan.c util.h cc.h
-$(objdir)/scope.o: scope.c util.h cc.h map.h
+$(objdir)/scope.o: scope.c util.h cc.h
$(objdir)/siphash.o: siphash.c
$(objdir)/stmt.o: stmt.c util.h cc.h
$(objdir)/token.o: token.c util.h cc.h
-$(objdir)/tree.o: tree.c util.h tree.h
+$(objdir)/tree.o: tree.c util.h
$(objdir)/type.o: type.c util.h cc.h
$(objdir)/util.o: util.c util.h
-$(objdir)/qbe.o: qbe.c util.h cc.h map.h tree.h ops.h
+$(objdir)/qbe.o: qbe.c util.h cc.h ops.h
diff --git a/map.c b/map.c
index c0f9b22..b8de316 100644
--- a/map.c
+++ b/map.c
@@ -4,7 +4,6 @@
#include <stdlib.h>
#include <string.h>
#include "util.h"
-#include "map.h"
struct map {
size_t len, cap;
diff --git a/map.h b/map.h
deleted file mode 100644
index df3139e..0000000
--- a/map.h
+++ /dev/null
@@ -1,12 +0,0 @@
-struct mapkey {
- uint64_t hash;
- const char *str;
- size_t len;
-};
-
-void mapkey(struct mapkey *, const char *, size_t);
-
-struct map *mkmap(size_t);
-void delmap(struct map *, void(void *));
-void **mapput(struct map *, struct mapkey *);
-void *mapget(struct map *, struct mapkey *);
diff --git a/qbe.c b/qbe.c
index cf63560..c496c41 100644
--- a/qbe.c
+++ b/qbe.c
@@ -7,8 +7,6 @@
#include <inttypes.h>
#include "util.h"
#include "cc.h"
-#include "map.h"
-#include "tree.h"
struct name {
char *str;
diff --git a/scope.c b/scope.c
index ae97b14..615d1fe 100644
--- a/scope.c
+++ b/scope.c
@@ -4,7 +4,6 @@
#include <string.h>
#include "util.h"
#include "cc.h"
-#include "map.h"
struct scope filescope;
diff --git a/tree.c b/tree.c
index 0e68fb5..468cb64 100644
--- a/tree.c
+++ b/tree.c
@@ -3,7 +3,6 @@
#include <stddef.h>
#include <stdint.h>
#include "util.h"
-#include "tree.h"
#define MAXH (sizeof(void *) * 8 * 3 / 2)
diff --git a/tree.h b/tree.h
deleted file mode 100644
index 6aa5c4e..0000000
--- a/tree.h
+++ /dev/null
@@ -1,8 +0,0 @@
-struct treenode {
- uint64_t key;
- void *child[2];
- int height;
- _Bool new; /* set by treeinsert if this node was newly allocated */
-};
-
-void *treeinsert(void **, uint64_t, size_t);
diff --git a/util.h b/util.h
index f60dc73..25cca14 100644
--- a/util.h
+++ b/util.h
@@ -7,6 +7,19 @@ struct array {
size_t len, cap;
};
+struct mapkey {
+ uint64_t hash;
+ const char *str;
+ size_t len;
+};
+
+struct treenode {
+ uint64_t key;
+ void *child[2];
+ int height;
+ _Bool new; /* set by treeinsert if this node was newly allocated */
+};
+
extern char *argv0;
#define LEN(a) (sizeof(a) / sizeof((a)[0]))
@@ -31,3 +44,15 @@ void *arrayadd(struct array *, size_t);
void arrayaddptr(struct array *, void *);
void arrayaddbuf(struct array *, const void *, size_t);
#define arrayforeach(a, m) for (m = (a)->val; m != (void *)((char *)(a)->val + (a)->len); ++m)
+
+/* map */
+
+void mapkey(struct mapkey *, const char *, size_t);
+struct map *mkmap(size_t);
+void delmap(struct map *, void(void *));
+void **mapput(struct map *, struct mapkey *);
+void *mapget(struct map *, struct mapkey *);
+
+/* tree */
+
+void *treeinsert(void **, uint64_t, size_t);