Skip to content

Commit 5550d17

Browse files
Use List.exists in unrollDesignatorForNestedAnonymous
Co-authored-by: michael-schwarz <13812333+michael-schwarz@users.noreply.github.com>
1 parent b8ac672 commit 5550d17

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/frontc/cabs2cil.ml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5637,10 +5637,9 @@ and doInit
56375637
(* We have a designator *)
56385638
| _, (what, ie) :: restil when what != A.NEXT_INIT ->
56395639
let rec unrollDesignatorForNestedAnonymous (comp: compinfo) (designator: string) (whatnext: initwhat) =
5640-
let own_field = List.find_opt (fun fld -> fld.fname = designator) comp.cfields in
5641-
match own_field with
5642-
| Some _ -> (true, Some(A.INFIELD_INIT (designator, whatnext)))
5643-
| None ->
5640+
if List.exists (fun fld -> fld.fname = designator) comp.cfields then
5641+
(true, Some(A.INFIELD_INIT (designator, whatnext)))
5642+
else
56445643
let anonymous_compounds = List.filter_map (fun f ->
56455644
(* f.ftype need not be unrolled here, inner anonymous struct cannot be typdef'ed *)
56465645
match f.ftype with

0 commit comments

Comments
 (0)