diff options
-rw-r--r-- | decl.c | 2 | ||||
-rw-r--r-- | map.c | 8 | ||||
-rw-r--r-- | map.h | 3 | ||||
-rw-r--r-- | qbe.c | 2 | ||||
-rw-r--r-- | scope.c | 8 |
5 files changed, 8 insertions, 15 deletions
@@ -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) { @@ -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) { @@ -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 *)); @@ -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) { @@ -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; } |