sockets.recv optimizations; stdlib now supports taint mode
This commit is contained in:
parent
485c371942
commit
0f37d0e1f2
14 changed files with 112 additions and 74 deletions
|
|
@ -14,7 +14,7 @@
|
|||
## wanted functionality.
|
||||
|
||||
when defined(Windows):
|
||||
proc ReadLineFromStdin*(prompt: string): string =
|
||||
proc ReadLineFromStdin*(prompt: string): TaintedString =
|
||||
## Reads a line from stdin.
|
||||
stdout.write(prompt)
|
||||
result = readLine(stdin)
|
||||
|
|
@ -22,11 +22,11 @@ when defined(Windows):
|
|||
else:
|
||||
import readline, history
|
||||
|
||||
proc ReadLineFromStdin*(prompt: string): string =
|
||||
proc ReadLineFromStdin*(prompt: string): TaintedString =
|
||||
var buffer = readline.readLine(prompt)
|
||||
if isNil(buffer): quit(0)
|
||||
result = $buffer
|
||||
if result.len > 0:
|
||||
result = TaintedString($buffer)
|
||||
if result.string.len > 0:
|
||||
add_history(buffer)
|
||||
readline.free(buffer)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue