Skip to content

Commit

Permalink
prevent sneaky copy. and remove checks that are bloat and are almost …
Browse files Browse the repository at this point in the history
…impossible of being hit.
  • Loading branch information
planetis-m committed Apr 23, 2024
1 parent e63446f commit a41c8ed
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/jsonpak/private/rawops.nim
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ proc rawTest*(a, b: JsonTree, na, nb: NodePos): bool =
of opcodeInt, opcodeFloat, opcodeString:
return a.atoms[LitId a.nodes[na.int].operand] == b.atoms[LitId b.nodes[nb.int].operand]
of opcodeArray:
if span(a, na.int) != span(b, nb.int):
return false
let lenA = len(a, na)
if lenA != len(b, nb):
return false
Expand All @@ -162,13 +160,11 @@ proc rawTest*(a, b: JsonTree, na, nb: NodePos): bool =
b.nextChild(posB)
return true
of opcodeObject:
if span(a, na.int) != span(b, nb.int):
return false
if len(a, na) != len(b, nb):
return false
for keyA in keys(a, na):
let valA = keyA.firstSon
let keyStrA = a.atoms[LitId a.nodes[keyA.int].operand]
template keyStrA: untyped = a.atoms[LitId a.nodes[keyA.int].operand]
let valB = b.rawGet(nb, keyStrA)
if valB.isNil or not rawTest(a, b, valA, valB):
return false
Expand Down

0 comments on commit a41c8ed

Please sign in to comment.