summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/hashmap.c
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-04-20 15:44:41 +0200
committerOndřej Surý <ondrej@sury.org>2011-04-20 15:44:41 +0200
commit50104cc32a498f7517a51c8dc93106c51c7a54b4 (patch)
tree47af80be259cc7c45d0eaec7d42e61fa38c8e4fb /src/pkg/runtime/hashmap.c
parentc072558b90f1bbedc2022b0f30c8b1ac4712538e (diff)
downloadgolang-50104cc32a498f7517a51c8dc93106c51c7a54b4.tar.gz
Imported Upstream version 2011.03.07.1upstream/2011.03.07.1
Diffstat (limited to 'src/pkg/runtime/hashmap.c')
-rw-r--r--src/pkg/runtime/hashmap.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/pkg/runtime/hashmap.c b/src/pkg/runtime/hashmap.c
index f0d5ce90a..e50cefd9a 100644
--- a/src/pkg/runtime/hashmap.c
+++ b/src/pkg/runtime/hashmap.c
@@ -781,6 +781,9 @@ runtime·mapaccess(Hmap *h, byte *ak, byte *av, bool *pres)
{
byte *res;
+ if(h == nil)
+ runtime·panicstring("lookup in nil map");
+
if(runtime·gcwaiting)
runtime·gosched();
@@ -802,6 +805,9 @@ runtime·mapaccess1(Hmap *h, ...)
byte *ak, *av;
bool pres;
+ if(h == nil)
+ runtime·panicstring("lookup in nil map");
+
ak = (byte*)&h + h->ko1;
av = (byte*)&h + h->vo1;
@@ -827,6 +833,9 @@ runtime·mapaccess2(Hmap *h, ...)
{
byte *ak, *av, *ap;
+ if(h == nil)
+ runtime·panicstring("lookup in nil map");
+
ak = (byte*)&h + h->ko1;
av = (byte*)&h + h->vo1;
ap = (byte*)&h + h->po1;
@@ -852,6 +861,9 @@ runtime·mapassign(Hmap *h, byte *ak, byte *av)
byte *res;
int32 hit;
+ if(h == nil)
+ runtime·panicstring("assignment to entry in nil map");
+
if(runtime·gcwaiting)
runtime·gosched();
@@ -889,6 +901,9 @@ runtime·mapassign1(Hmap *h, ...)
{
byte *ak, *av;
+ if(h == nil)
+ runtime·panicstring("assignment to entry in nil map");
+
ak = (byte*)&h + h->ko2;
av = (byte*)&h + h->vo2;
@@ -902,6 +917,9 @@ runtime·mapassign2(Hmap *h, ...)
{
byte *ak, *av, *ap;
+ if(h == nil)
+ runtime·panicstring("assignment to entry in nil map");
+
ak = (byte*)&h + h->ko2;
av = (byte*)&h + h->vo2;
ap = (byte*)&h + h->po2;