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 | eee50ae1ac25dec3047e111fd62ee1f83e874e26 (patch) | |
| tree | d43976b2cd9eccadecab471683f3248c928480ce /src/runtime/hashmap.c | |
| parent | cbff09d6666bf4c2e4152fba5c858ae481a263d5 (diff) | |
| download | go-eee50ae1ac25dec3047e111fd62ee1f83e874e26.tar.xz | |
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 | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/runtime/hashmap.c b/src/runtime/hashmap.c index 5b32fe5881..5be990c49c 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"); + 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"); + } - throw("sys·newmap: key/val algorithm out of range"); + 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)); |
