mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 18:32:11 +00:00
copy replaced by substr
This commit is contained in:
@@ -56,7 +56,7 @@ proc parseStatus(r: TRedis): TRedisStatus =
|
||||
if line[0] != '+':
|
||||
raiseInvalidReply('+', line[0])
|
||||
|
||||
return line.copy(1, line.len-3) # Strip '+' and \c\L.
|
||||
return line.substr(1, line.len-3) # Strip '+' and \c\L.
|
||||
|
||||
proc parseInteger(r: TRedis): TRedisInteger =
|
||||
var line = r.socket.recv()
|
||||
@@ -92,7 +92,7 @@ proc parseBulk(r: TRedis, allowMBNil = False): TRedisString =
|
||||
if line[0] != '$':
|
||||
raiseInvalidReply('$', line[0])
|
||||
|
||||
var numBytes = parseInt(line.copy(1))
|
||||
var numBytes = parseInt(line.substr(1))
|
||||
if numBytes == -1:
|
||||
return RedisNil
|
||||
|
||||
@@ -107,7 +107,7 @@ proc parseMultiBulk(r: TRedis): TRedisList =
|
||||
if line[0] != '*':
|
||||
raiseInvalidReply('*', line[0])
|
||||
|
||||
var numElems = parseInt(line.copy(1))
|
||||
var numElems = parseInt(line.substr(1))
|
||||
if numElems == -1: return nil
|
||||
result = @[]
|
||||
for i in 1..numElems:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2010 Andreas Rumpf
|
||||
# (c) Copyright 2011 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
@@ -39,7 +39,7 @@ proc scgiError*(msg: string) {.noreturn.} =
|
||||
proc parseWord(inp: string, outp: var string, start: int): int =
|
||||
result = start
|
||||
while inp[result] != '\0': inc(result)
|
||||
outp = copy(inp, start, result-1)
|
||||
outp = substr(inp, start, result-1)
|
||||
|
||||
proc parseHeaders(s: string, L: int): PStringTable =
|
||||
result = newStringTable()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2010 Andreas Rumpf
|
||||
# (c) Copyright 2011 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
|
||||
Reference in New Issue
Block a user