]> git.proxmox.com Git - pve-common.git/commitdiff
array_intersect: allow passing list of references for convenience
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 23 Jul 2019 07:12:51 +0000 (09:12 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 23 Jul 2019 07:14:34 +0000 (09:14 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Tools.pm

index a9addcd7e595cc0737a0f1d3eca9f84da9e18447..676647eefb375d8d1ad00e9d06ab404baab9c906 100644 (file)
@@ -1654,6 +1654,10 @@ sub dev_t_minor($) {
 sub array_intersect {
     my ($arrays) = @_;
 
+    if (!ref($arrays->[0])) {
+       $arrays = [ grep { ref($_) eq 'ARRAY' } @_ ];
+    }
+
     return [] if scalar(@$arrays) == 0;
     return $arrays->[0] if scalar(@$arrays) == 1;