From c866ac822f5c00362ccd9d5c33e80b4c4d4c8e4d Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Fri, 8 Nov 2019 20:12:48 +0100 Subject: [PATCH] TT#69200 Switch to an early return in arrayeq() to reduce nesting level Change-Id: I04ea1a4c9007ba1ebb6c0ecfbd2b716a53a7475f (cherry picked from commit 64d4ec32ad758ee99b74583a08a56b51067ce0b3) --- lib/NGCP/BulkProcessor/Array.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/NGCP/BulkProcessor/Array.pm b/lib/NGCP/BulkProcessor/Array.pm index 63a6f4b..f7e86d1 100644 --- a/lib/NGCP/BulkProcessor/Array.pm +++ b/lib/NGCP/BulkProcessor/Array.pm @@ -141,9 +141,8 @@ sub arrayeq { my $ubound1 = _array_last($array_ptr1) // -1; my $ubound2 = _array_last($array_ptr2) // -1; - if ($ubound1 != $ubound2) { - return 0; - } else { + return 0 if $ubound1 != $ubound2; + if ($case_insensitive) { for (my $i = 0; $i <= $ubound1; $i += 1) { if (lc($array_ptr1->[$i]) ne lc($array_ptr2->[$i])) { @@ -157,7 +156,6 @@ sub arrayeq { } } } - } return 1;