Skip to content

Commit 57bd834

Browse files
committed
maintenance: use Stdlib's List.filter_map
This is a cosmetic change Signed-off-by: Pau Ruiz Safont <[email protected]>
1 parent 45df4b1 commit 57bd834

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

lib/network_utils.ml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -540,11 +540,11 @@ module Ip = struct
540540

541541
let get_ipv4 dev =
542542
let addrs = addr dev "inet" in
543-
Xapi_stdext_std.Listext.List.filter_map split_addr addrs
543+
List.filter_map split_addr addrs
544544

545545
let get_ipv6 dev =
546546
let addrs = addr dev "inet6" in
547-
Xapi_stdext_std.Listext.List.filter_map split_addr addrs
547+
List.filter_map split_addr addrs
548548

549549
let set_ip_addr dev (ip, prefixlen) =
550550
let addr = Printf.sprintf "%s/%d" (Unix.string_of_inet_addr ip) prefixlen in
@@ -815,7 +815,7 @@ module Linux_bonding = struct
815815
debug "Failed to get property \"%s\" on bond %s" prop master ;
816816
None
817817
in
818-
Xapi_stdext_std.Listext.List.filter_map get_prop known_props
818+
List.filter_map get_prop known_props
819819
else (
820820
debug "Bond %s does not exist; cannot get properties" master ;
821821
[]
@@ -1495,7 +1495,7 @@ module Ovs = struct
14951495
| None ->
14961496
None
14971497
in
1498-
Xapi_stdext_std.Listext.List.filter_map parse lines
1498+
List.filter_map parse lines
14991499
in
15001500
List.flatten
15011501
(List.map
@@ -1699,7 +1699,7 @@ module Ovs = struct
16991699
; ("lacp-actor-key", "other-config:lacp-actor-key")
17001700
])
17011701
and other_args =
1702-
Xapi_stdext_std.Listext.List.filter_map
1702+
List.filter_map
17031703
(fun (k, v) ->
17041704
if List.mem k known_props then
17051705
None
@@ -1915,7 +1915,6 @@ module Modprobe = struct
19151915
*)
19161916
let get_config_from_comments driver =
19171917
try
1918-
let open Xapi_stdext_std.Listext in
19191918
Unixext.read_lines ~path:(getpath driver)
19201919
|> List.filter_map (fun x ->
19211920
let line = String.trim x in

networkd/network_server.ml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,14 +1286,8 @@ module Bridge = struct
12861286
(fun (bridge, _, _) -> List.mem bridge ifaces)
12871287
(Proc.get_vlans ())
12881288
in
1289-
let bond_ifaces =
1290-
List.filter
1291-
(fun iface -> Linux_bonding.is_bond_device iface)
1292-
ifaces
1293-
in
1294-
let physical_ifaces =
1295-
List.filter (fun iface -> Sysfs.is_physical iface) ifaces
1296-
in
1289+
let bond_ifaces = List.filter Linux_bonding.is_bond_device ifaces in
1290+
let physical_ifaces = List.filter Sysfs.is_physical ifaces in
12971291
match (vlan_ifaces, bond_ifaces) with
12981292
| (_, _, parent) :: _, _ when Linux_bonding.is_bond_device parent ->
12991293
Linux_bonding.get_bond_slaves parent
@@ -1335,7 +1329,7 @@ module Bridge = struct
13351329
(String.concat ", "
13361330
(List.map (fun (name, _) -> name) persistent_config)) ;
13371331
let vlan_parents =
1338-
Xapi_stdext_std.Listext.List.filter_map
1332+
List.filter_map
13391333
(function
13401334
| _, {vlan= Some (parent, _); _} ->
13411335
if not (List.mem_assoc parent persistent_config) then

0 commit comments

Comments
 (0)