summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-09-15 20:32:20 +0200
committerAraq <rumpf_a@web.de>2018-09-15 20:32:20 +0200
commit0e33a8676e325fa4174893291ed41d59b689c577 (patch)
tree7f747fd449659c1fab08b80dde84dd3fc5d11c5c /lib/system
parent7df722844b8f7a6f56c098677abda98e852a1761 (diff)
parentb9b611a2b97bbdf573c03e56205ce0ad08aa168e (diff)
downloadNim-0e33a8676e325fa4174893291ed41d59b689c577.tar.gz
Merge branch 'devel' of github.com:nim-lang/Nim into devel
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/sysio.nim7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim
index df13ab628..61835e0f7 100644
--- a/lib/system/sysio.nim
+++ b/lib/system/sysio.nim
@@ -145,10 +145,9 @@ proc readLine(f: File, line: var TaintedString): bool =
   var pos = 0
 
   # Use the currently reserved space for a first try
-  var sp = line.string.len
-  if sp == 0:
-    sp = 80
-    line.string.setLen(sp)
+  var sp = max(line.string.len, 80)
+  line.string.setLen(sp)
+
   while true:
     # memset to \L so that we can tell how far fgets wrote, even on EOF, where
     # fgets doesn't append an \L