replace shallowcopy with move in ARC/ORC (#20061)
This commit is contained in:
parent
2549d398a9
commit
d934ba9326
1 changed files with 6 additions and 6 deletions
|
|
@ -218,10 +218,6 @@ proc newJRawNumber(s: string): JsonNode =
|
||||||
## to the string representation without the quotes.
|
## to the string representation without the quotes.
|
||||||
result = JsonNode(kind: JString, str: s, isUnquoted: true)
|
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 =
|
proc newJInt*(n: BiggestInt): JsonNode =
|
||||||
## Creates a new `JInt JsonNode`.
|
## Creates a new `JInt JsonNode`.
|
||||||
result = JsonNode(kind: JInt, num: n)
|
result = JsonNode(kind: JInt, num: n)
|
||||||
|
|
@ -859,8 +855,12 @@ proc parseJson(p: var JsonParser; rawIntegers, rawFloats: bool, depth = 0): Json
|
||||||
case p.tok
|
case p.tok
|
||||||
of tkString:
|
of tkString:
|
||||||
# we capture 'p.a' here, so we need to give it a fresh buffer afterwards:
|
# we capture 'p.a' here, so we need to give it a fresh buffer afterwards:
|
||||||
result = newJStringMove(p.a)
|
when defined(gcArc) or defined(gcOrc):
|
||||||
p.a = ""
|
result = JsonNode(kind: JString, str: move p.a)
|
||||||
|
else:
|
||||||
|
result = JsonNode(kind: JString)
|
||||||
|
shallowCopy(result.str, p.a)
|
||||||
|
p.a = ""
|
||||||
discard getTok(p)
|
discard getTok(p)
|
||||||
of tkInt:
|
of tkInt:
|
||||||
if rawIntegers:
|
if rawIntegers:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue