From 06a28ff2e486773e2849eab84cfe8c3f34a3f604 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Fri, 15 Dec 2017 14:20:08 +0100 Subject: [PATCH] util.inc, dead code detection --- src/etc/inc/util.inc | 53 -------------------------------------------- 1 file changed, 53 deletions(-) diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 7191736ee..18d0abd8d 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -610,59 +610,6 @@ function is_portoralias($port) return is_port($port); } -/* create ranges of sequential port numbers (200:215) and remove duplicates */ -function group_ports($ports) -{ - if (!is_array($ports) || empty($ports)) { - return; - } - - $uniq = array(); - foreach ($ports as $port) { - if (is_portrange($port)) { - list($begin, $end) = explode(":", $port); - if ($begin > $end) { - $aux = $begin; - $begin = $end; - $end = $aux; - } - for ($i = $begin; $i <= $end; $i++) { - if (!in_array($i, $uniq)) { - $uniq[] = $i; - } - } - } elseif (is_port($port)) { - if (!in_array($port, $uniq)) { - $uniq[] = $port; - } - } - } - sort($uniq, SORT_NUMERIC); - - $result = array(); - foreach ($uniq as $idx => $port) { - if ($idx == 0) { - $result[] = $port; - continue; - } - - $last = end($result); - if (is_portrange($last)) { - list($begin, $end) = explode(":", $last); - } else { - $begin = $end = $last; - } - if ($port == ($end+1)) { - $end++; - $result[count($result)-1] = "{$begin}:{$end}"; - } else { - $result[] = $port; - } - } - - return $result; -} - /* returns true if $test is in the range between $start and $end */ function is_inrange_v4($test, $start, $end) {