Skip to content

Commit fe4b6b1

Browse files
committed
Use String.sub alternatives found by semgrep
1 parent f1daea0 commit fe4b6b1

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/cdomain/value/cdomains/addressDomain.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ struct
277277
let compute_substring s1 s2 =
278278
try
279279
let i = Str.search_forward (Str.regexp_string s2) s1 0 in
280-
Some (String.sub s1 i (String.length s1 - i))
280+
Some (Str.string_after s1 i)
281281
with Not_found -> None in
282282

283283
(* if any of the input address sets contains an element that isn't a StrPtr, return top *)

src/cdomain/value/cdomains/stringDomain.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ let to_n_c_string n x =
6262
else if n < 0 then
6363
None
6464
else
65-
Some (String.sub x 0 n)
65+
Some (Str.first_chars x n)
6666
| None -> None
6767

6868
let to_string_length x =

src/cdomains/apron/affineEqualityDomain.apron.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ struct
282282
let res = (String.concat "" @@ Array.to_list @@ Array.map dim_to_str vars)
283283
^ (const_to_str arr.(Array.length arr - 1)) ^ "=0" in
284284
if String.starts_with res "+" then
285-
String.sub res 1 (String.length res - 1)
285+
Str.string_after res 1
286286
else
287287
res
288288
in

src/config/gobConfig.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ struct
140140
let rec split' i =
141141
if i<l then begin
142142
if xs.[i]=c1 || xs.[i]=c2 then
143-
(String.sub xs 0 i, String.sub xs i (l-i))
143+
(Str.first_chars xs i, Str.string_after xs i)
144144
else
145145
split' (i+1)
146146
end else

0 commit comments

Comments
 (0)