]> Cypherpunks repositories - gostls13.git/commitdiff
allow pointers as keys in maps, treating them the same as ints - ptr eq not value...
authorRob Pike <r@golang.org>
Tue, 5 Aug 2008 18:14:35 +0000 (11:14 -0700)
committerRob Pike <r@golang.org>
Tue, 5 Aug 2008 18:14:35 +0000 (11:14 -0700)
R=ken,gri
OCL=13879
CL=13879

src/runtime/map.c
src/runtime/runtime.c

index 93a985f15e4fbbd99dd91b9bc0357658309169e8..f945e8c47b5c38a89b5c0272f62b077330fdac5d 100644 (file)
@@ -40,7 +40,7 @@ sys·newmap(uint32 keysize, uint32 valsize,
 {
        Hmap *m;
 
-       if(keyalg >= 2 ||
+       if(keyalg >= 3 ||
           valalg >= 3) {
                prints("0<=");
                sys·printint(keyalg);
index 75d23d50d8b5f017940465dd69d69cae83e42ede..ec2951b0af6c991951417422b46ff8eed93c2a8e 100644 (file)
@@ -777,7 +777,8 @@ pointercopy(uint32 s, void **a, void **b)
 Alg
 algarray[3] =
 {
-       {       &memhash,       &memequal,      &memprint,      &memcopy        },
-       {       &stringhash,    &stringequal,   &stringprint,   &stringcopy     },
-       {       &pointerhash,   &pointerequal,  &pointerprint,  &pointercopy    },
+       {       &memhash,       &memequal,      &memprint,      &memcopy        },  // 0
+       {       &stringhash,    &stringequal,   &stringprint,   &stringcopy     },  // 1
+//     {       &pointerhash,   &pointerequal,  &pointerprint,  &pointercopy    },  // 2
+       {       &memhash,       &memequal,      &memprint,      &memcopy        },  // 2 - treat pointers as ints
 };