diff --git a/src/libraries/stdlib/extlib.ml b/src/libraries/stdlib/extlib.ml index cc38506a68ff6865ed2ab29459b5a4a05af33f56..eb390757a97b6b543ee941dcd0e08d17841a00ab 100644 --- a/src/libraries/stdlib/extlib.ml +++ b/src/libraries/stdlib/extlib.ml @@ -102,12 +102,6 @@ let replace cmp x l = | y::l -> if cmp x y then x::l else y :: aux l in aux l -let filter_map' f filter l= - let rec aux = function - | [] -> [] - | x::tl -> let x' = f x in if filter x' then x' :: aux tl else aux tl - in aux l - let rec fold_map f acc = function | [] -> acc, [] | x::tl -> diff --git a/src/libraries/stdlib/extlib.mli b/src/libraries/stdlib/extlib.mli index 8cf8182f59d105a2aebebed9ba69e4186d44ce2d..0229ce3436ffdf0178f24d9bc4d8731f80bba28a 100644 --- a/src/libraries/stdlib/extlib.mli +++ b/src/libraries/stdlib/extlib.mli @@ -102,8 +102,6 @@ val replace: ('a -> 'a -> bool) -> 'a -> 'a list -> 'a list @since Neon-20140301 *) -val filter_map': ('a -> 'b) -> ('b -> bool) -> 'a list -> 'b list - val fold_map: ('a -> 'b -> 'a * 'c) -> 'a -> 'b list -> 'a * 'c list (** Combines [fold_left] and [map] *) diff --git a/src/plugins/eva/domains/multidim/multidim.ml b/src/plugins/eva/domains/multidim/multidim.ml index 9e08333cbc135438beb258c4600561e35b5d9a1f..951ea36b24863263998c84226f1f49a943bef463 100644 --- a/src/plugins/eva/domains/multidim/multidim.ml +++ b/src/plugins/eva/domains/multidim/multidim.ml @@ -174,11 +174,11 @@ let mul_int x i = let mod_integer (o,sum) i = (* mod everything *) let o = Integer.e_rem o i in - let sum = Extlib.filter_map' - (fun (d,b) -> Integer.e_rem d i, b) - (fun (d,_b) -> not (Integer.is_zero d)) - sum + let non_zero_rem (d, b) = + let rem = Integer.e_rem d i in + if Integer.is_zero rem then None else Some (rem, b) in + let sum = List.filter_map non_zero_rem sum in let sum = Terms.(normalize (reorder sum)) in (* order was not preserverd *) (* We must then ensure that the set of represented offset is < i, i.e. that the highest possible value is < i. diff --git a/src/plugins/gui/filetree.ml b/src/plugins/gui/filetree.ml index f1b9ad235814e23a7bdc2bc9eb134dc46538f4ae..351d8528aec8a354f160a1de3867149649d0c838 100644 --- a/src/plugins/gui/filetree.ml +++ b/src/plugins/gui/filetree.ml @@ -455,9 +455,10 @@ module State = struct Cil_builtins.is_unused_builtin vi | _ -> false in - f, Extlib.filter_out is_unused all + let gls = Extlib.filter_out is_unused all in + if gls = [] then None else Some (f, gls) in - Extlib.filter_map' globals_of_file (fun (_, gl) -> gl <> []) files + List.filter_map globals_of_file files (** Make and fill the custom model with default values. *) diff --git a/tests/libc/check_compliance.ml b/tests/libc/check_compliance.ml index 542109885e37bf262e67cbf9f93275d9b27c91a4..63485ebba93189813c0dfd40c83a2aea4d2c1e22 100644 --- a/tests/libc/check_compliance.ml +++ b/tests/libc/check_compliance.ml @@ -18,12 +18,11 @@ class stdlib_visitor = object in_stdlib := false; Cil.SkipChildren | attrparams -> - let headers = - Extlib.filter_map' (fun ap -> - match ap with - | AStr s -> s - | _ -> assert false - ) (Extlib.string_suffix ".h") attrparams + let when_header = function + | AStr s when Extlib.string_suffix ".h" s -> Some s + | _ -> None + in + let headers = List.filter_map when_header attrparams in in_stdlib := true; begin