summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2016-09-09 20:41:26 +0200
committerAraq <rumpf_a@web.de>2016-09-09 20:41:26 +0200
commit3a3aeb94ecf2b0a0f91470719f5e22dc6ff475c6 (patch)
tree8420abc4e1d4d0eb8a69976d443bf5e28c624a42 /lib
parent0a2cc05541c8ea78e0cc08a2f85b17ae409151a1 (diff)
downloadNim-3a3aeb94ecf2b0a0f91470719f5e22dc6ff475c6.tar.gz
minor stdlib cleanups
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/httpcore.nim20
-rw-r--r--lib/pure/os.nim8
-rw-r--r--lib/pure/securehash.nim10
3 files changed, 19 insertions, 19 deletions
diff --git a/lib/pure/httpcore.nim b/lib/pure/httpcore.nim
index 562d16c19..e1be746ed 100644
--- a/lib/pure/httpcore.nim
+++ b/lib/pure/httpcore.nim
@@ -81,7 +81,7 @@ proc newHttpHeaders*(keyValuePairs:
     openarray[tuple[key: string, val: string]]): HttpHeaders =
   var pairs: seq[tuple[key: string, val: seq[string]]] = @[]
   for pair in keyValuePairs:
-    pairs.add((pair.key.toLower(), @[pair.val]))
+    pairs.add((pair.key.toLowerAscii(), @[pair.val]))
   new result
   result.table = newTable[string, seq[string]](pairs)
 
@@ -96,7 +96,7 @@ proc `[]`*(headers: HttpHeaders, key: string): HttpHeaderValues =
   ##
   ## To access multiple values of a key, use the overloaded ``[]`` below or
   ## to get all of them access the ``table`` field directly.
-  return headers.table[key.toLower].HttpHeaderValues
+  return headers.table[key.toLowerAscii].HttpHeaderValues
 
 converter toString*(values: HttpHeaderValues): string =
   return seq[string](values)[0]
@@ -105,26 +105,26 @@ proc `[]`*(headers: HttpHeaders, key: string, i: int): string =
   ## Returns the ``i``'th value associated with the given key. If there are
   ## no values associated with the key or the ``i``'th value doesn't exist,
   ## an exception is raised.
-  return headers.table[key.toLower][i]
+  return headers.table[key.toLowerAscii][i]
 
 proc `[]=`*(headers: HttpHeaders, key, value: string) =
   ## Sets the header entries associated with ``key`` to the specified value.
   ## Replaces any existing values.
-  headers.table[key.toLower] = @[value]
+  headers.table[key.toLowerAscii] = @[value]
 
 proc `[]=`*(headers: HttpHeaders, key: string, value: seq[string]) =
   ## Sets the header entries associated with ``key`` to the specified list of
   ## values.
   ## Replaces any existing values.
-  headers.table[key.toLower] = value
+  headers.table[key.toLowerAscii] = value
 
 proc add*(headers: HttpHeaders, key, value: string) =
   ## Adds the specified value to the specified key. Appends to any existing
   ## values associated with the key.
-  if not headers.table.hasKey(key.toLower):
-    headers.table[key.toLower] = @[value]
+  if not headers.table.hasKey(key.toLowerAscii):
+    headers.table[key.toLowerAscii] = @[value]
   else:
-    headers.table[key.toLower].add(value)
+    headers.table[key.toLowerAscii].add(value)
 
 iterator pairs*(headers: HttpHeaders): tuple[key, value: string] =
   ## Yields each key, value pair.
@@ -136,10 +136,10 @@ proc contains*(values: HttpHeaderValues, value: string): bool =
   ## Determines if ``value`` is one of the values inside ``values``. Comparison
   ## is performed without case sensitivity.
   for val in seq[string](values):
-    if val.toLower == value.toLower: return true
+    if val.toLowerAscii == value.toLowerAscii: return true
 
 proc hasKey*(headers: HttpHeaders, key: string): bool =
-  return headers.table.hasKey(key.toLower())
+  return headers.table.hasKey(key.toLowerAscii())
 
 proc getOrDefault*(headers: HttpHeaders, key: string,
     default = @[""].HttpHeaderValues): HttpHeaderValues =
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index 1e474f4d4..343c82f5e 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -595,12 +595,12 @@ when not declared(ENOENT) and not defined(Windows):
 
 when defined(Windows):
   when useWinUnicode:
-    template deleteFile(file: expr): expr {.immediate.} = deleteFileW(file)
-    template setFileAttributes(file, attrs: expr): expr {.immediate.} =
+    template deleteFile(file: untyped): untyped  = deleteFileW(file)
+    template setFileAttributes(file, attrs: untyped): untyped =
       setFileAttributesW(file, attrs)
   else:
-    template deleteFile(file: expr): expr {.immediate.} = deleteFileA(file)
-    template setFileAttributes(file, attrs: expr): expr {.immediate.} =
+    template deleteFile(file: untyped): untyped = deleteFileA(file)
+    template setFileAttributes(file, attrs: untyped): untyped =
       setFileAttributesA(file, attrs)
 
 proc removeFile*(file: string) {.rtl, extern: "nos$1", tags: [WriteDirEffect].} =
diff --git a/lib/pure/securehash.nim b/lib/pure/securehash.nim
index a30fad92a..2c59bdf4a 100644
--- a/lib/pure/securehash.nim
+++ b/lib/pure/securehash.nim
@@ -90,10 +90,10 @@ proc innerHash(state: var Sha1State, w: var Sha1Buffer) =
 
   var round = 0
 
-  template rot(value, bits: uint32): uint32 {.immediate.} =
+  template rot(value, bits: uint32): uint32 =
     (value shl bits) or (value shr (32 - bits))
 
-  template sha1(fun, val: uint32): stmt =
+  template sha1(fun, val: uint32) =
     let t = rot(a, 5) + fun + e + val + w[round]
     e = d
     d = c
@@ -101,12 +101,12 @@ proc innerHash(state: var Sha1State, w: var Sha1Buffer) =
     b = a
     a = t
 
-  template process(body: stmt): stmt =
+  template process(body: untyped) =
     w[round] = rot(w[round - 3] xor w[round - 8] xor w[round - 14] xor w[round - 16], 1)
     body
     inc(round)
 
-  template wrap(dest, value: expr): stmt {.immediate.} =
+  template wrap(dest, value: untyped) =
     let v = dest + value
     dest = v
 
@@ -136,7 +136,7 @@ proc innerHash(state: var Sha1State, w: var Sha1Buffer) =
   wrap state[3], d
   wrap state[4], e
 
-template computeInternal(src: expr): stmt {.immediate.} =
+template computeInternal(src: untyped) =
   #Initialize state
   var state: Sha1State
   init(state)