]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: minor cleanup of hashmap code
authorDmitriy Vyukov <dvyukov@google.com>
Tue, 16 Jul 2013 15:51:18 +0000 (19:51 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Tue, 16 Jul 2013 15:51:18 +0000 (19:51 +0400)
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/11357043

src/pkg/runtime/hashmap.c

index 2e61bcfe8fad8ae707272162ede4861b7370a9d2..0215a4718ea81e2a27d972f4428707da2ea67acb 100644 (file)
@@ -610,7 +610,7 @@ hash_insert(MapType *t, Hmap *h, void *key, void *value)
        top = hash >> (sizeof(uintptr)*8 - 8);
        if(top == 0)
                top = 1;
-       inserti = 0;
+       inserti = nil;
        insertk = nil;
        insertv = nil;
        while(true) {
@@ -1485,12 +1485,8 @@ reflect·mapiterkey(struct hash_iter *it, uintptr key, bool ok)
        key = 0;
        ok = false;
        res = it->key;
-       if(res == nil) {
-               key = 0;
-               ok = false;
-       } else {
+       if(res != nil) {
                tkey = it->t->key;
-               key = 0;
                if(tkey->size <= sizeof(key))
                        tkey->alg->copy(tkey->size, (byte*)&key, res);
                else