aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--decl.c2
-rw-r--r--map.c8
-rw-r--r--map.h3
-rw-r--r--qbe.c2
-rw-r--r--scope.c8
5 files changed, 8 insertions, 15 deletions
diff --git a/decl.c b/decl.c
index 46d1336..5576c6e 100644
--- a/decl.c
+++ b/decl.c
@@ -962,7 +962,7 @@ struct decl *stringdecl(struct expr *expr)
if (!strings)
strings = mkmap(64);
assert(expr->kind == EXPRSTRING);
- mapbufkey(&key, expr->string.data, expr->string.size);
+ mapkey(&key, expr->string.data, expr->string.size);
entry = mapput(strings, &key);
d = *entry;
if (!d) {
diff --git a/map.c b/map.c
index 736233b..c0f9b22 100644
--- a/map.c
+++ b/map.c
@@ -25,19 +25,13 @@ hash(const void *ptr, size_t len)
}
void
-mapbufkey(struct mapkey *k, const char *s, size_t n)
+mapkey(struct mapkey *k, const char *s, size_t n)
{
k->str = s;
k->len = n;
k->hash = hash(s, n);
}
-void
-mapstrkey(struct mapkey *k, const char *s)
-{
- mapbufkey(k, s, strlen(s));
-}
-
struct map *
mkmap(size_t cap)
{
diff --git a/map.h b/map.h
index c1dd5e1..df3139e 100644
--- a/map.h
+++ b/map.h
@@ -4,8 +4,7 @@ struct mapkey {
size_t len;
};
-void mapstrkey(struct mapkey *, const char *);
-void mapbufkey(struct mapkey *, const char *, size_t);
+void mapkey(struct mapkey *, const char *, size_t);
struct map *mkmap(size_t);
void delmap(struct map *, void(void *));
diff --git a/qbe.c b/qbe.c
index 3364df2..cf63560 100644
--- a/qbe.c
+++ b/qbe.c
@@ -462,7 +462,7 @@ funcgoto(struct func *f, char *name)
struct gotolabel *g;
struct mapkey key;
- mapstrkey(&key, name);
+ mapkey(&key, name, strlen(name));
entry = mapput(f->gotos, &key);
g = *entry;
if (!g) {
diff --git a/scope.c b/scope.c
index c9461d7..ae97b14 100644
--- a/scope.c
+++ b/scope.c
@@ -70,7 +70,7 @@ scopegetdecl(struct scope *s, const char *name, bool recurse)
struct decl *d;
struct mapkey k;
- mapstrkey(&k, name);
+ mapkey(&k, name, strlen(name));
do {
d = s->decls ? mapget(s->decls, &k) : NULL;
s = s->parent;
@@ -85,7 +85,7 @@ scopegettag(struct scope *s, const char *name, bool recurse)
struct type *t;
struct mapkey k;
- mapstrkey(&k, name);
+ mapkey(&k, name, strlen(name));
do {
t = s->tags ? mapget(s->tags, &k) : NULL;
s = s->parent;
@@ -101,7 +101,7 @@ scopeputdecl(struct scope *s, const char *name, struct decl *d)
if (!s->decls)
s->decls = mkmap(32);
- mapstrkey(&k, name);
+ mapkey(&k, name, strlen(name));
*mapput(s->decls, &k) = d;
}
@@ -112,6 +112,6 @@ scopeputtag(struct scope *s, const char *name, struct type *t)
if (!s->tags)
s->tags = mkmap(32);
- mapstrkey(&k, name);
+ mapkey(&k, name, strlen(name));
*mapput(s->tags, &k) = t;
}