more replacements for the deprecated '<'

This commit is contained in:
Andreas Rumpf 2017-10-29 08:55:30 +01:00
commit 6a3288a60e
19 changed files with 43 additions and 43 deletions

View file

@ -127,7 +127,7 @@ proc fileMatches(c, bp: cstring): bool =
proc canonFilename*(filename: cstring): cstring =
## returns 'nil' if the filename cannot be found.
for i in 0 .. <dbgFilenameLen:
for i in 0 ..< dbgFilenameLen:
result = dbgFilenames[i]
if fileMatches(result, filename): return result
result = nil

View file

@ -643,9 +643,9 @@ when useMarkForDebug or useBackupGc:
forAllChildren(d, waMarkPrecise)
proc markGlobals(gch: var GcHeap) =
for i in 0 .. < globalMarkersLen: globalMarkers[i]()
for i in 0 .. globalMarkersLen-1: globalMarkers[i]()
let d = gch.additionalRoots.d
for i in 0 .. < gch.additionalRoots.len: markS(gch, d[i])
for i in 0 .. gch.additionalRoots.len-1: markS(gch, d[i])
when logGC:
var
@ -653,7 +653,7 @@ when logGC:
cycleCheckALen = 0
proc alreadySeen(c: PCell): bool =
for i in 0 .. <cycleCheckALen:
for i in 0 .. cycleCheckALen-1:
if cycleCheckA[i] == c: return true
if cycleCheckALen == len(cycleCheckA):
gcAssert(false, "cycle detection overflow")

View file

@ -487,12 +487,12 @@ proc GC_dumpHeap*(file: File) =
var spaceIter: ObjectSpaceIter
when false:
var d = gch.decStack.d
for i in 0 .. < gch.decStack.len:
for i in 0 .. gch.decStack.len-1:
if isAllocatedPtr(gch.region, d[i]):
c_fprintf(file, "onstack %p\n", d[i])
else:
c_fprintf(file, "onstack_invalid %p\n", d[i])
for i in 0 .. < globalMarkersLen: globalMarkers[i]()
for i in 0 .. globalMarkersLen-1: globalMarkers[i]()
while true:
let x = allObjectsAsProc(gch.region, addr spaceIter)
if spaceIter.state < 0: break
@ -579,7 +579,7 @@ proc markIncremental(gch: var GcHeap): bool =
result = true
proc markGlobals(gch: var GcHeap) =
for i in 0 .. < globalMarkersLen: globalMarkers[i]()
for i in 0 .. globalMarkersLen-1: globalMarkers[i]()
proc doOperation(p: pointer, op: WalkOp) =
if p == nil: return

View file

@ -450,9 +450,9 @@ when false:
quit 1
proc markGlobals(gch: var GcHeap) =
for i in 0 .. < globalMarkersLen: globalMarkers[i]()
for i in 0 .. globalMarkersLen-1: globalMarkers[i]()
let d = gch.additionalRoots.d
for i in 0 .. < gch.additionalRoots.len: mark(gch, d[i])
for i in 0 .. gch.additionalRoots.len-1: mark(gch, d[i])
proc gcMark(gch: var GcHeap, p: pointer) {.inline.} =
# the addresses are not as cells on the stack, so turn them to cells:

View file

@ -41,7 +41,7 @@ proc `$`(x: uint64): string =
let half = i div 2
# Reverse
for t in 0 .. < half: swap(result[t], result[i-t-1])
for t in 0 .. half-1: swap(result[t], result[i-t-1])
proc reprStrAux(result: var string, s: cstring; len: int) =
if cast[pointer](s) == nil:

View file

@ -50,7 +50,7 @@ proc reprChar(x: char): string {.compilerRtl.} =
proc reprStrAux(result: var string, s: cstring, len: int) =
add(result, "\"")
for i in 0 .. <len:
for i in 0 ..< len:
let c = s[i]
case c
of '"': add(result, "\\\"")
@ -149,7 +149,7 @@ proc reprArray(a: pointer, typ: PNimType,
{. emit: "`len` = `a`.length;\n" .}
var dereffed: pointer = a
for i in 0 .. < len:
for i in 0 ..< len:
if i > 0 :
add(result, ", ")
# advance pointer and point to element at index
@ -192,7 +192,7 @@ proc reprRecordAux(result: var string, o: pointer, typ: PNimType, cl: var ReprCl
reprAux(result, val, typ.node.typ, cl)
else:
# if the object has more than one field, sons is not nil and contains the fields.
for i in 0 .. <typ.node.len:
for i in 0 ..< typ.node.len:
if first: first = false
else: add(result, ",\n")

View file

@ -278,7 +278,7 @@ proc setLengthSeq(seq: PGenericSeq, elemSize, newLen: int): PGenericSeq {.
GenericSeqSize +% (i*%elemSize)),
extGetCellType(result).base, waPush)
let len1 = gch.tempStack.len
for i in len0 .. <len1:
for i in len0 ..< len1:
doDecRef(gch.tempStack.d[i], LocalHeap, MaybeCyclic)
gch.tempStack.len = len0
else: