Use local function

master
Nicolás Ojeda Bär 2018-02-28 09:28:47 +01:00
parent 3cfb0bfe6f
commit 35a75212dc
1 changed files with 6 additions and 6 deletions

View File

@ -100,13 +100,13 @@ let trim s =
then bts (B.trim (bos s))
else s
let rec escape s n i =
if i >= n then s else
match unsafe_get s i with
| '\"' | '\\' | '\000'..'\031' | '\127'.. '\255' -> bts (B.escaped (bos s))
| _ -> escape s n (i+1)
let escaped s =
let rec escape s n i =
if i >= n then s else
match unsafe_get s i with
| '\"' | '\\' | '\000'..'\031' | '\127'.. '\255' -> bts (B.escaped (bos s))
| _ -> escape s n (i+1)
in
escape s (length s) 0
(* duplicated in bytes.ml *)