From 3fea8c5b3c79147365d89ae225da3f69471576ad Mon Sep 17 00:00:00 2001 From: Antonis Geralis Date: Tue, 16 Apr 2024 00:24:06 +0300 Subject: [PATCH] busy commit --- docs/sorted.html | 24 ++++++++++++------------ src/jsonpak/private/rawops_sorted.nim | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/sorted.html b/docs/sorted.html index ec4ffbb..43fecc2 100644 --- a/docs/sorted.html +++ b/docs/sorted.html @@ -5,7 +5,7 @@ -jsonpak/sorted +src/jsonpak/sorted @@ -20,7 +20,7 @@
-

jsonpak/sorted

+

src/jsonpak/sorted

@@ -93,7 +93,7 @@

jsonpak/sorted

@@ -121,9 +121,9 @@

Procs

forbids: [].}
- The equality comparison for SortedJsonTree is faster than the one for JsonTree. - Source   -Edit   + The equality comparison for SortedJsonTree is faster than the one for JsonTree. + Source   +Edit  
@@ -134,11 +134,11 @@

Procs

proc deduplicate(tree: var SortedJsonTree) {....raises: [], tags: [], forbids: [].}
-

Deduplicates keys in tree recursively. If duplicate keys are found, only the last occurrence of each key is kept.

+

Deduplicates keys in tree recursively. If duplicate keys are found, only the last occurrence of the key is kept.

The deduplication is performed in-place.

- Source   -Edit   + Source   +Edit  
@@ -151,8 +151,8 @@

Procs

Sorts all the keys of tree recursively, ensuring that the resulting tree has its keys in lexicographic order. - Source   -Edit   + Source   +Edit  
@@ -168,7 +168,7 @@

Procs

diff --git a/src/jsonpak/private/rawops_sorted.nim b/src/jsonpak/private/rawops_sorted.nim index e42bfd5..2093540 100644 --- a/src/jsonpak/private/rawops_sorted.nim +++ b/src/jsonpak/private/rawops_sorted.nim @@ -52,9 +52,9 @@ proc rawDeduplicate*(tree: var JsonTree, n: NodePos, parents: var seq[PatchPos]) of opcodeObject: parents.add n.PatchPos var totaldiff = 0 + var pos = n.firstSon.int var curr = 0 var last = len(tree, n)-1 - var pos = n.firstSon.int while curr <= last: var i = curr var tmp = pos @@ -71,8 +71,8 @@ proc rawDeduplicate*(tree: var JsonTree, n: NodePos, parents: var seq[PatchPos]) dec totaldiff, diff else: inc curr - if not isAtom(tree, pos+1): - rawDeduplicate(tree, NodePos(pos+1), parents) + if isAtom(tree, pos+1): discard + else: rawDeduplicate(tree, NodePos(pos+1), parents) inc pos nextChild tree, pos if totaldiff < 0: @@ -80,12 +80,12 @@ proc rawDeduplicate*(tree: var JsonTree, n: NodePos, parents: var seq[PatchPos]) parents.setLen(parents.high) of opcodeArray: parents.add n.PatchPos - var pos = n.int+1 + var pos = n.firstSon.int let last = len(tree, n)-1 var curr = 0 while curr <= last: - if not isAtom(tree, pos): - rawDeduplicate(tree, NodePos(pos), parents) + if isAtom(tree, pos): discard + else: rawDeduplicate(tree, NodePos(pos), parents) inc curr nextChild tree, pos parents.setLen(parents.high)