From 4e83d0788e915b0fd59b2579d5e0c1dda56f0f87 Mon Sep 17 00:00:00 2001
From: Tom Eastep <teastep@shorewall.net>
Date: Sat, 11 Apr 2020 13:42:41 -0700
Subject: [PATCH] Rename valuesort() to sortchainsiftest() and remove keysort()

Signed-off-by: Tom Eastep <teastep@shorewall.net>
---
 Shorewall/Perl/Shorewall/Chains.pm | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm
index 470c53dc0..215f418c0 100644
--- a/Shorewall/Perl/Shorewall/Chains.pm
+++ b/Shorewall/Perl/Shorewall/Chains.pm
@@ -3710,15 +3710,7 @@ sub optimize_level0() {
 #
 # Conditionally sort a list of chain table entry references by name, if -t was specified
 #
-
-sub keysort(\%) {
-    my $hashref = shift;
-
-    return sort { $a->{name} cmp $b->{name} } keys %$hashref if $test;
-    return keys %$hashref;
-}
-
-sub valuesort(\%) {
+sub sortchainsiftest(\%) {
     my $hashref = shift;
 
     return sort { $a->{name} cmp $b->{name} } values %$hashref if $test;
@@ -3946,7 +3938,7 @@ sub optimize_level4( $$ ) {
     my @chains  = grep ( $_->{referenced}   &&
 			 ! $_->{optflags}   &&
 			 @{$_->{rules}} < 4 &&
-			 keys %{$_->{references}} == 1 , valuesort %$tableref );
+			 keys %{$_->{references}} == 1 , sortchainsiftest %$tableref );
 
     if ( my $chains  = @chains ) {
 	$passes++;
@@ -4598,7 +4590,7 @@ sub combine_states {
 
 sub optimize_level16( $$$ ) {
     my ( $table, $tableref , $passes ) = @_;
-    my @chains   = ( grep $_->{referenced}, valuesort %{$tableref} );
+    my @chains   = ( grep $_->{referenced}, sortchainsiftest %{$tableref} );
     my @chains1  = @chains;
     my $chains   = @chains;