diff options
author | Sverker Eriksson <sverker@erlang.org> | 2014-01-14 20:32:46 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <egil@erlang.org> | 2014-01-29 11:08:45 +0100 |
commit | d39affeac223a7e2891b509395e7b19c931b5018 (patch) | |
tree | e5a933029a98f8e7b71ae7aaad96a664cdff8d0e /erts/emulator/beam/erl_nif.c | |
parent | 609d835ce04a1f6320377780a11fb32382e1e419 (diff) | |
download | otp-d39affeac223a7e2891b509395e7b19c931b5018.tar.gz otp-d39affeac223a7e2891b509395e7b19c931b5018.tar.bz2 otp-d39affeac223a7e2891b509395e7b19c931b5018.zip |
erts: Remove use of h_limit which is always zero.
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index def9a7efe1..94c2512650 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -1718,7 +1718,6 @@ int enif_map_iterator_create(ErlNifEnv *env, iter->ks = ((Eterm *)map_get_keys(mp)) + offset; iter->vs = ((Eterm *)map_get_values(mp)) + offset; iter->t_limit = map_get_size(mp) + 1; - iter->h_limit = 0; iter->idx = offset + 1; return 1; @@ -1744,8 +1743,7 @@ int enif_map_iterator_is_tail(ErlNifEnv *env, ErlNifMapIterator *iter) { ASSERT(iter && is_map(iter->map)); ASSERT(iter->idx >= 0 && (iter->idx <= map_get_size(map_val(iter->map)) + 1)); - if ((iter->t_limit - iter->h_limit) == 1 - || iter->idx == iter->t_limit) { + if (iter->t_limit == 1 || iter->idx == iter->t_limit) { return 1; } return 0; @@ -1755,8 +1753,7 @@ int enif_map_iterator_is_head(ErlNifEnv *env, ErlNifMapIterator *iter) { ASSERT(iter && is_map(iter->map)); ASSERT(iter->idx >= 0 && (iter->idx <= map_get_size(map_val(iter->map)) + 1)); - if ((iter->t_limit - iter->h_limit) == 1 - || iter->idx == iter->h_limit) { + if (iter->t_limit == 1 || iter->idx == 0) { return 1; } return 0; @@ -1780,9 +1777,9 @@ int enif_map_iterator_next(ErlNifEnv *env, ErlNifMapIterator *iter) int enif_map_iterator_prev(ErlNifEnv *env, ErlNifMapIterator *iter) { ASSERT(iter && is_map(iter->map)); - if (iter->idx > iter->h_limit ) { + if (iter->idx > 0) { iter->idx--; - if (iter->idx != iter->h_limit ) { + if (iter->idx != 0) { iter->ks--; iter->vs--; return 1; @@ -1797,7 +1794,7 @@ int enif_map_iterator_get_pair(ErlNifEnv *env, Eterm *value) { ASSERT(iter && is_map(iter->map)); - if (iter->idx > iter->h_limit && iter->idx < iter->t_limit) { + if (iter->idx > 0 && iter->idx < iter->t_limit) { ASSERT(iter->ks >= map_get_keys(map_val(iter->map)) && iter->ks < (map_get_keys(map_val(iter->map)) + map_get_size(map_val(iter->map)))); ASSERT(iter->vs >= map_get_values(map_val(iter->map)) && |