Skip to content
Snippets Groups Projects
Commit b9bd8317 authored by Allan Blanchard's avatar Allan Blanchard
Browse files

Merge branch 'feature/julien/array_forall' into 'master'

use Array.for_all in structural_descr.ml

See merge request frama-c/frama-c!3183
parents 52cf2ad1 2df4e4ea
No related branches found
No related tags found
No related merge requests found
...@@ -144,16 +144,8 @@ let poly f = function ...@@ -144,16 +144,8 @@ let poly f = function
| Structure _ | T_pack _ as a -> | Structure _ | T_pack _ as a ->
try from_unmarshal (f (to_unmarshal a)) with Cannot_pack -> Unknown try from_unmarshal (f (to_unmarshal a)) with Cannot_pack -> Unknown
(* would be better to put it in Extlib, but no access to this library here *)
let array_for_all f a =
try
Array.iter (fun x -> if not (f x) then raise Exit) a;
true
with Exit ->
false
let is_abstract_array a = let is_abstract_array a =
array_for_all (fun x -> x = Pack Unmarshal.Abstract) a Array.for_all (fun x -> x = Pack Unmarshal.Abstract) a
let poly_arr f a = let poly_arr f a =
if is_abstract_array a then Abstract if is_abstract_array a then Abstract
...@@ -185,7 +177,7 @@ let t_map_unchanged_compares = poly2 Unmarshal.t_map_unchangedcompares ...@@ -185,7 +177,7 @@ let t_map_unchanged_compares = poly2 Unmarshal.t_map_unchangedcompares
let t_hashtbl_unchanged_hashs = poly2 (Unmarshal.t_hashtbl_unchangedhashs) let t_hashtbl_unchanged_hashs = poly2 (Unmarshal.t_hashtbl_unchangedhashs)
let t_sum a = let t_sum a =
if array_for_all (is_abstract_array) a then Abstract if Array.for_all (is_abstract_array) a then Abstract
else Structure (Sum a) else Structure (Sum a)
(* ********************************************************************** *) (* ********************************************************************** *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment