mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 13:30:33 +00:00
replace shallowcopy with move in ARC/ORC (#20061)
This commit is contained in:
@@ -218,10 +218,6 @@ proc newJRawNumber(s: string): JsonNode =
|
||||
## to the string representation without the quotes.
|
||||
result = JsonNode(kind: JString, str: s, isUnquoted: true)
|
||||
|
||||
proc newJStringMove(s: string): JsonNode =
|
||||
result = JsonNode(kind: JString)
|
||||
shallowCopy(result.str, s)
|
||||
|
||||
proc newJInt*(n: BiggestInt): JsonNode =
|
||||
## Creates a new `JInt JsonNode`.
|
||||
result = JsonNode(kind: JInt, num: n)
|
||||
@@ -859,8 +855,12 @@ proc parseJson(p: var JsonParser; rawIntegers, rawFloats: bool, depth = 0): Json
|
||||
case p.tok
|
||||
of tkString:
|
||||
# we capture 'p.a' here, so we need to give it a fresh buffer afterwards:
|
||||
result = newJStringMove(p.a)
|
||||
p.a = ""
|
||||
when defined(gcArc) or defined(gcOrc):
|
||||
result = JsonNode(kind: JString, str: move p.a)
|
||||
else:
|
||||
result = JsonNode(kind: JString)
|
||||
shallowCopy(result.str, p.a)
|
||||
p.a = ""
|
||||
discard getTok(p)
|
||||
of tkInt:
|
||||
if rawIntegers:
|
||||
|
||||
Reference in New Issue
Block a user