aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/map.goc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-09-21 17:37:50 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-09-21 17:37:50 +0000
commite6f8e5901625f2c77ea317a3d770c52d966b5e77 (patch)
tree72d064eacaba81463aeeb1607f050c5b0151b34a /libgo/runtime/map.goc
parentbd352290bcbe1c80ce47ea3aa4d66d17a6e8d482 (diff)
downloadgcc-e6f8e5901625f2c77ea317a3d770c52d966b5e77.zip
gcc-e6f8e5901625f2c77ea317a3d770c52d966b5e77.tar.gz
gcc-e6f8e5901625f2c77ea317a3d770c52d966b5e77.tar.bz2
Support nil maps.
From-SVN: r179054
Diffstat (limited to 'libgo/runtime/map.goc')
-rw-r--r--libgo/runtime/map.goc11
1 files changed, 6 insertions, 5 deletions
diff --git a/libgo/runtime/map.goc b/libgo/runtime/map.goc
index d6308cb..e19bc96 100644
--- a/libgo/runtime/map.goc
+++ b/libgo/runtime/map.goc
@@ -9,17 +9,18 @@ package runtime
typedef unsigned char byte;
typedef _Bool bool;
-typedef struct __go_map hmap;
+typedef struct __go_map_type MapType;
+typedef struct __go_map Hmap;
typedef struct __go_hash_iter hiter;
/* Access a value in a map, returning a value and a presence indicator. */
-func mapaccess2(h *hmap, key *byte, val *byte) (present bool) {
+func mapaccess2(t *MapType, h *Hmap, key *byte, val *byte) (present bool) {
byte *mapval;
size_t valsize;
mapval = __go_map_index(h, key, 0);
- valsize = h->__descriptor->__map_descriptor->__val_type->__size;
+ valsize = t->__val_type->__size;
if (mapval == nil) {
__builtin_memset(val, 0, valsize);
present = 0;
@@ -31,7 +32,7 @@ func mapaccess2(h *hmap, key *byte, val *byte) (present bool) {
/* Optionally assign a value to a map (m[k] = v, p). */
-func mapassign2(h *hmap, key *byte, val *byte, p bool) {
+func mapassign2(h *Hmap, key *byte, val *byte, p bool) {
if (!p) {
__go_map_delete(h, key);
} else {
@@ -46,7 +47,7 @@ func mapassign2(h *hmap, key *byte, val *byte, p bool) {
/* Initialize a range over a map. */
-func mapiterinit(h *hmap, it *hiter) {
+func mapiterinit(h *Hmap, it *hiter) {
__go_mapiterinit(h, it);
}