[X2Go-Commits] [x2goserver] 30/99: X2Go/Server/Agent/NX/Options.pm: avoid copying arrays if not necessary when passing to grep and map operations.

git-admin at x2go.org git-admin at x2go.org
Mon Dec 28 06:10:41 CET 2020


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goserver.

commit b4ac4e83b14bdf61bba1a9abed281dccd10cbde3
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sun Nov 8 03:44:21 2020 +0100

    X2Go/Server/Agent/NX/Options.pm: avoid copying arrays if not necessary when passing to grep and map operations.
---
 X2Go/Server/Agent/NX/Options.pm | 6 +++---
 debian/changelog                | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm
index 3982e1cf..b0e6e612 100644
--- a/X2Go/Server/Agent/NX/Options.pm
+++ b/X2Go/Server/Agent/NX/Options.pm
@@ -583,7 +583,7 @@ sub transform_intermediate {
 
     if (MODE_REMOVE == $mode) {
       # Let the filter function handle the actual work.
-      @{$ret} = grep { filter_option_remove ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret});
+      @{$ret} = grep { filter_option_remove ($work_option_key, $work_option_value, $_, --$elements_left) } @{$ret};
 
       # Check to see if the intermediate representation is empty now (save for
       # the display port entry) and add an empty element if it is.
@@ -600,11 +600,11 @@ sub transform_intermediate {
       # another dependency and option strings are pretty small, so don't
       # overoptimize here.
       ## no critic (BuiltinFunctions::ProhibitBooleanGrep)
-      if (scalar (grep { filter_find_key ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}))) {
+      if (scalar (grep { filter_find_key ($work_option_key, $work_option_value, $_, --$elements_left) } @{$ret})) {
       ## critic (BuiltinFunctions::ProhibitBooleanGrep)
         # Such an option already exists, we'll modify all occurrences.
         $elements_left = @{$ret};
-        $ret = [ map { filter_option_modify ($work_option_key, $work_option_value, $_, --$elements_left) } (@{$ret}) ];
+        $ret = [ map { filter_option_modify ($work_option_key, $work_option_value, $_, --$elements_left) } @{$ret} ];
       }
       else {
         my $new_opt = { $work_option_key => $work_option_value };
diff --git a/debian/changelog b/debian/changelog
index 07dde87f..8de6381f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -238,6 +238,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium
       and silence others.
     - X2Go/Server/Agent/NX/Options.pm: grammar/typo fix in comment and improve
       a different comment.
+    - X2Go/Server/Agent/NX/Options.pm: avoid copying arrays if not necessary
+      when passing to grep and map operations.
   * debian/control:
     + Build-depend upon lsb-release for distro version detection.
   * debian/x2goserver.manpages:

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list