Fix couch_ejson_compare:less/2 for complex values The equality comparisons in the functions used by couch_ejson_compare:less/2 were never updated to return 0 for equal values as they were always assuming to return pure ordering information. This fixes the missing cases for both arrays and objects.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/9573e90e Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/9573e90e Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/9573e90e Branch: refs/heads/windsor-merge Commit: 9573e90e09dad737e9d739780821ee01b7bbb0bd Parents: f4c988a Author: Paul J. Davis <[email protected]> Authored: Sun Aug 17 12:49:09 2014 -0500 Committer: Robert Newson <[email protected]> Committed: Tue Aug 26 10:44:12 2014 +0100 ---------------------------------------------------------------------- src/couch_ejson_compare.erl | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/9573e90e/src/couch_ejson_compare.erl ---------------------------------------------------------------------- diff --git a/src/couch_ejson_compare.erl b/src/couch_ejson_compare.erl index a1c5b21..81adbb8 100644 --- a/src/couch_ejson_compare.erl +++ b/src/couch_ejson_compare.erl @@ -73,6 +73,8 @@ atom_sort(null) -> 1; atom_sort(false) -> 2; atom_sort(true) -> 3. +less_props([], []) -> + 0; less_props([], [_|_]) -> -1; less_props(_, []) -> @@ -90,6 +92,8 @@ less_props([{AKey, AValue}|RestA], [{BKey, BValue}|RestB]) -> Result end. +less_list([], []) -> + 0; less_list([], [_|_]) -> -1; less_list(_, []) ->
