From: Rob Pike Date: Tue, 5 Aug 2008 18:14:35 +0000 (-0700) Subject: allow pointers as keys in maps, treating them the same as ints - ptr eq not value... X-Git-Tag: weekly.2009-11-06~3366 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5adbacb8e7856cd56617e788c112e012303bcb82;p=gostls13.git allow pointers as keys in maps, treating them the same as ints - ptr eq not value equality R=ken,gri OCL=13879 CL=13879 --- diff --git a/src/runtime/map.c b/src/runtime/map.c index 93a985f15e..f945e8c47b 100644 --- a/src/runtime/map.c +++ b/src/runtime/map.c @@ -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); diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c index 75d23d50d8..ec2951b0af 100644 --- a/src/runtime/runtime.c +++ b/src/runtime/runtime.c @@ -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 };