summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Thompson <ken@golang.org>2010-03-23 13:00:02 -0700
committerKen Thompson <ken@golang.org>2010-03-23 13:00:02 -0700
commit5b9ce3dc4dc68bafb6bfc70ea33f67e42eecd859 (patch)
treee07e584cebf5794c6d2fe3671068251cd0da651d
parent17de0489f64376b64fc7936c698659905327e6ff (diff)
downloadgo-5b9ce3dc4dc68bafb6bfc70ea33f67e42eecd859.tar.gz
maps access to a missing key
will return the "zero" value R=rsc CC=golang-dev http://codereview.appspot.com/700041
-rw-r--r--src/pkg/runtime/hashmap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pkg/runtime/hashmap.c b/src/pkg/runtime/hashmap.c
index 281601fbc..ccb5cfdb5 100644
--- a/src/pkg/runtime/hashmap.c
+++ b/src/pkg/runtime/hashmap.c
@@ -769,8 +769,10 @@ void
av = (byte*)&h + h->vo1;
mapaccess(h, ak, av, &pres);
- if(!pres)
- throw("runtime.mapaccess1: key not in map");
+
+// new spec -- all elements have "zero" value
+// if(!pres)
+// throw("runtime.mapaccess1: key not in map");
if(debug) {
prints("runtime.mapaccess1: map=");