diff options
author | Vitaliy Batichko <[email protected]> | 2010-12-10 16:38:13 +0200 |
---|---|---|
committer | Vitaliy Batichko <[email protected]> | 2010-12-10 17:39:56 +0200 |
commit | 384b85a75212cf73253f901a8c88d4286a5962ba (patch) | |
tree | 9649a4368f09f4f42d2ff2dac217da6d615676ef /lib/erl_interface/src/legacy | |
parent | 7992d6a6bfa0f460f8663c2d72d07b60755a4857 (diff) | |
download | otp-384b85a75212cf73253f901a8c88d4286a5962ba.tar.gz otp-384b85a75212cf73253f901a8c88d4286a5962ba.tar.bz2 otp-384b85a75212cf73253f901a8c88d4286a5962ba.zip |
Fix wrong erl_compare_ext result comparing lists
Function erl_compare_ext of erl_interface library returns
1 instead -1 when comparing lists like [0] and [0, 1000].
Credits to: Evgeny Khirin <evgeny.khirin <at> erlios.com>
Diffstat (limited to 'lib/erl_interface/src/legacy')
-rw-r--r-- | lib/erl_interface/src/legacy/erl_marshal.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/erl_interface/src/legacy/erl_marshal.c b/lib/erl_interface/src/legacy/erl_marshal.c index a6c2f64dd0..70949a7adf 100644 --- a/lib/erl_interface/src/legacy/erl_marshal.c +++ b/lib/erl_interface/src/legacy/erl_marshal.c @@ -1646,11 +1646,14 @@ static int cmp_exe2(unsigned char **e1, unsigned char **e2) min = (i < j) ? i : j; k = 0; while (1) { - if (k++ == min) - return compare_top_ext(e1 , e2); - if ((ret = compare_top_ext(e1 , e2)) == 0) - continue; - return ret; + if (k++ == min){ + if (i == j) return 0; + if (i < j) return -1; + return 1; + } + if ((ret = compare_top_ext(e1 , e2)) == 0) + continue; + return ret; } case ERL_STRING_EXT: i = (**e1 << 8) | ((*e1)[1]); |