summaryrefslogtreecommitdiff
path: root/src
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
commit55df7f0002cd12a7e9e95ea38b83bdd73443af87 (patch)
treee07e584cebf5794c6d2fe3671068251cd0da651d /src
parent3515ef9d3b3cc90214cb2fe8e4df55c9d775a8f5 (diff)
downloadgolang-55df7f0002cd12a7e9e95ea38b83bdd73443af87.tar.gz
maps access to a missing key
will return the "zero" value R=rsc CC=golang-dev http://codereview.appspot.com/700041
Diffstat (limited to 'src')
-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=");