diff options
author | Russ Cox <rsc@golang.org> | 2008-12-19 12:05:22 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2008-12-19 12:05:22 -0800 |
commit | 81f94fb52eba71ffc3873e5260be33a59457dfa3 (patch) | |
tree | d43976b2cd9eccadecab471683f3248c928480ce /src/runtime/hashmap.c | |
parent | a56193282819f795ad648ef9df4651661a5e3d71 (diff) | |
download | golang-81f94fb52eba71ffc3873e5260be33a59457dfa3.tar.gz |
chan and map of [] and struct
R=r
DELTA=192 (145 added, 8 deleted, 39 changed)
OCL=21609
CL=21614
Diffstat (limited to 'src/runtime/hashmap.c')
-rw-r--r-- | src/runtime/hashmap.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/runtime/hashmap.c b/src/runtime/hashmap.c index 5b32fe588..5be990c49 100644 --- a/src/runtime/hashmap.c +++ b/src/runtime/hashmap.c @@ -663,19 +663,30 @@ sys·newmap(uint32 keysize, uint32 valsize, { Hmap *h; - if(keyalg >= 4 || - valalg >= 4) { - prints("0<="); - sys·printint(keyalg); - prints("<"); - sys·printint(nelem(algarray)); - prints("\n0<="); - sys·printint(valalg); - prints("<"); - sys·printint(nelem(algarray)); - prints("\n"); - - throw("sys·newmap: key/val algorithm out of range"); + switch(keyalg) { + case ASIMP: + case ASTRING: + case APTR: + case AINTER: + case AARRAY: + case ASTRUCT: + break; + default: + printf("map(keyalg=%d)\n", keyalg); + throw("sys·newmap: unsupported map key type"); + } + + switch(valalg) { + case ASIMP: + case ASTRING: + case APTR: + case AINTER: + case AARRAY: + case ASTRUCT: + break; + default: + printf("map(valalg=%d)\n", valalg); + throw("sys·newmap: unsupported map value type"); } h = mal(sizeof(*h)); |