This commit is contained in:
Andreas Rumpf 2020-05-11 19:12:40 +02:00 • committed by GitHub
commit 0f344a70c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 11 deletions

View file

@ -299,21 +299,15 @@ template piRest*(my: XmlParser): string =
assert(my.kind == xmlPI) assert(my.kind == xmlPI)
my.b my.b
proc rawData*(my: var XmlParser): string {.inline.} = proc rawData*(my: var XmlParser): lent string {.inline.} =
## returns the underlying 'data' string by reference. ## returns the underlying 'data' string by reference.
## This is only used for speed hacks. ## This is only used for speed hacks.
when defined(gcDestructors): result = my.a
result = move(my.a)
else:
shallowCopy(result, my.a)
proc rawData2*(my: var XmlParser): string {.inline.} = proc rawData2*(my: var XmlParser): lent string {.inline.} =
## returns the underlying second 'data' string by reference. ## returns the underlying second 'data' string by reference.
## This is only used for speed hacks. ## This is only used for speed hacks.
when defined(gcDestructors): result = my.b
result = move(my.b)
else:
shallowCopy(result, my.b)
proc getColumn*(my: XmlParser): int {.inline.} = proc getColumn*(my: XmlParser): int {.inline.} =
## get the current column the parser has arrived at. ## get the current column the parser has arrived at.

View file

@ -228,7 +228,7 @@ proc enlarge(t: StringTableRef) =
var n: KeyValuePairSeq var n: KeyValuePairSeq
newSeq(n, len(t.data) * growthFactor) newSeq(n, len(t.data) * growthFactor)
for i in countup(0, high(t.data)): for i in countup(0, high(t.data)):
if t.data[i].hasValue: rawInsert(t, n, t.data[i].key, t.data[i].val) if t.data[i].hasValue: rawInsert(t, n, move t.data[i].key, move t.data[i].val)
swap(t.data, n) swap(t.data, n)
proc `[]=`*(t: StringTableRef, key, val: string) {. proc `[]=`*(t: StringTableRef, key, val: string) {.