diff options
author | Björn-Egil Dahlberg <[email protected]> | 2016-04-04 11:57:12 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2016-04-04 11:57:12 +0200 |
commit | 01012debc01ba667a0dffb9ae6b10b0cbb1b567e (patch) | |
tree | 6fc444e4c2880dcda2dbb2567ff84e8368b5bd12 /erts/emulator/beam | |
parent | c9f63aa227432e5adfb1a6743887c6c8d47a60b3 (diff) | |
parent | f86eabba45b351890ea8a12bd976c02b799c0e93 (diff) | |
download | otp-01012debc01ba667a0dffb9ae6b10b0cbb1b567e.tar.gz otp-01012debc01ba667a0dffb9ae6b10b0cbb1b567e.tar.bz2 otp-01012debc01ba667a0dffb9ae6b10b0cbb1b567e.zip |
Merge branch 'egil/erts/fix-flatmap-get/OTP-13459'
* egil/erts/fix-flatmap-get/OTP-13459:
erts: Don't search for non-existing Map keys twice
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/erl_map.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/erts/emulator/beam/erl_map.c b/erts/emulator/beam/erl_map.c index 4b6931f848..6b747256e1 100644 --- a/erts/emulator/beam/erl_map.c +++ b/erts/emulator/beam/erl_map.c @@ -196,13 +196,13 @@ erts_maps_get(Eterm key, Eterm map) return &vs[i]; } } - } - - for (i = 0; i < n; i++) { - if (EQ(ks[i], key)) { - return &vs[i]; - } - } + } else { + for (i = 0; i < n; i++) { + if (EQ(ks[i], key)) { + return &vs[i]; + } + } + } return NULL; } ASSERT(is_hashmap(map)); |