summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorflywind <xzsflywind@gmail.com>2021-06-01 05:28:22 +0800
committerGitHub <noreply@github.com>2021-05-31 23:28:22 +0200
commitc0e8199acc9f49caa36bae34d103600d112b66f3 (patch)
tree7e46be1f1135db2b9f5ab351dd278619ca4023f9 /lib
parent06d50bfd4cac6611c5fc775c8130cad87e4dcee1 (diff)
downloadNim-c0e8199acc9f49caa36bae34d103600d112b66f3.tar.gz
[std/re] fix findBounds and find procs (#18028)
* [std/re] make interface consistent

* tiny

* revert
Diffstat (limited to 'lib')
-rw-r--r--lib/impure/re.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/impure/re.nim b/lib/impure/re.nim
index 0c96876b9..40860cc88 100644
--- a/lib/impure/re.nim
+++ b/lib/impure/re.nim
@@ -171,7 +171,7 @@ proc findBounds*(s: string, pattern: Regex, matches: var openArray[string],
 
 proc findBounds*(buf: cstring, pattern: Regex,
                  matches: var openArray[tuple[first, last: int]],
-                 start = 0, bufSize = 0): tuple[first, last: int] =
+                 start = 0, bufSize: int): tuple[first, last: int] =
   ## returns the starting position and end position of `pattern` in `buf`
   ## (where `buf` has length `bufSize` and is not necessarily `'\0'` terminated),
   ## and the captured substrings in the array `matches`.
@@ -290,7 +290,7 @@ proc match*(buf: cstring, pattern: Regex, matches: var openArray[string],
   result = matchLen(buf, pattern, matches, start, bufSize) != -1
 
 proc find*(buf: cstring, pattern: Regex, matches: var openArray[string],
-           start = 0, bufSize = 0): int =
+           start = 0, bufSize: int): int =
   ## returns the starting position of `pattern` in `buf` and the captured
   ## substrings in the array `matches`. If it does not match, nothing
   ## is written into `matches` and `-1` is returned.