use system.move instead of system.shallowCopy if the GC mode requires it

This commit is contained in:
Andreas Rumpf
2019-10-03 16:46:09 +02:00
parent 68ce808db1
commit 60d64d1aef
14 changed files with 61 additions and 36 deletions

View File

@@ -399,11 +399,14 @@ proc hash(x: IndexEntry): Hash =
result = result !& x.linkDesc.hash
result = !$result
proc `<-`(a: var IndexEntry, b: IndexEntry) =
shallowCopy a.keyword, b.keyword
shallowCopy a.link, b.link
shallowCopy a.linkTitle, b.linkTitle
shallowCopy a.linkDesc, b.linkDesc
when defined(gcDestructors):
template `<-`(a, b: var IndexEntry) = a = move(b)
else:
proc `<-`(a: var IndexEntry, b: IndexEntry) =
shallowCopy a.keyword, b.keyword
shallowCopy a.link, b.link
shallowCopy a.linkTitle, b.linkTitle
shallowCopy a.linkDesc, b.linkDesc
proc sortIndex(a: var openArray[IndexEntry]) =
# we use shellsort here; fast and simple