]> Cypherpunks repositories - gostls13.git/commitdiff
string hash function faults w empty string
authorKen Thompson <ken@golang.org>
Wed, 10 Dec 2008 21:28:46 +0000 (13:28 -0800)
committerKen Thompson <ken@golang.org>
Wed, 10 Dec 2008 21:28:46 +0000 (13:28 -0800)
fixes maps[""]

R=r
OCL=20909
CL=20911

src/runtime/runtime.c

index 3d0ee7f1e63663da8d408d78e795b209f3623494..c075181a02d6508944bc75758a29e67f21566705 100644 (file)
@@ -583,6 +583,8 @@ static uint64
 stringhash(uint32 s, string *a)
 {
        USED(s);
+       if(*a == nil)
+               return memhash(emptystring->len, emptystring->str);
        return memhash((*a)->len, (*a)->str);
 }