aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2015-03-19 17:41:00 +0100
committerSverker Eriksson <[email protected]>2015-03-19 17:43:01 +0100
commitf958a56e0c7c672cd19f386b58f9abd54e128a6d (patch)
tree9a624e4f648d30be71e4da573dbaed6fa227c1f9
parent65c7116bb38013c3d829f21b00bf094606e46731 (diff)
downloadotp-f958a56e0c7c672cd19f386b58f9abd54e128a6d.tar.gz
otp-f958a56e0c7c672cd19f386b58f9abd54e128a6d.tar.bz2
otp-f958a56e0c7c672cd19f386b58f9abd54e128a6d.zip
erts: Silence valgrind warning in nif_SUITE.c
Hmm, seems like gcc (4.4.3 at least) can switch the order of an &&-expression and do the last condition first if it think it's more efficient (and without side effects I hope). Which led to valgrind complaining about 'prev_ret' being used uninitialized in this case.
-rw-r--r--erts/emulator/test/nif_SUITE_data/nif_SUITE.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c
index 7b49f23d0a..5a3be84825 100644
--- a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c
+++ b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c
@@ -1717,8 +1717,9 @@ static ERL_NIF_TERM sorted_list_from_maps_nif(ErlNifEnv* env, int argc, const ER
return enif_make_int(env, __LINE__);
cnt = 0;
+ next_ret = 1;
while(enif_map_iterator_get_pair(env,&iter_f,&key,&value)) {
- if (cnt && !next_ret)
+ if (!next_ret)
return enif_make_int(env, __LINE__);
list_f = enif_make_list_cell(env, enif_make_tuple2(env, key, value), list_f);
next_ret = enif_map_iterator_next(env,&iter_f);
@@ -1731,8 +1732,9 @@ static ERL_NIF_TERM sorted_list_from_maps_nif(ErlNifEnv* env, int argc, const ER
return enif_make_int(env, __LINE__);
cnt = 0;
+ prev_ret = 1;
while(enif_map_iterator_get_pair(env,&iter_b,&key,&value)) {
- if (cnt && !prev_ret)
+ if (!prev_ret)
return enif_make_int(env, __LINE__);
/* Test that iter_f can step "backwards" */