[X2Go-Commits] [x2goserver] 59/99: X2Go/Server/Agent/NX/Options.pm: port modes "enum" subs to the constant pragma to make the code more consistent with the program wrapper.

git-admin at x2go.org git-admin at x2go.org
Mon Dec 28 06:10:48 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 43cfdcc1f915d6ba2e50b079761424afd644b805
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sun Nov 22 22:12:18 2020 +0100

    X2Go/Server/Agent/NX/Options.pm: port modes "enum" subs to the constant pragma to make the code more consistent with the program wrapper.
---
 X2Go/Server/Agent/NX/Options.pm | 9 ++++++---
 debian/changelog                | 2 ++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/X2Go/Server/Agent/NX/Options.pm b/X2Go/Server/Agent/NX/Options.pm
index e1ad68cc..79bb4d44 100644
--- a/X2Go/Server/Agent/NX/Options.pm
+++ b/X2Go/Server/Agent/NX/Options.pm
@@ -34,9 +34,12 @@ our @EXPORT_OK = qw (MODE_INVALID MODE_ADD_UPDATE MODE_REMOVE
 # These are actually supposed to be enums, but since Perl doesn't have a
 # proper way of creating enums (at least not natively), we'll emulate that
 # using small functions.
-sub MODE_INVALID    { return 0; }
-sub MODE_ADD_UPDATE { return 1; }
-sub MODE_REMOVE     { return 2; }
+# IF adding more modes, please make sure that each number is a proper
+# power-of-two. While we currently don't rely on this here, we might do so
+# later.
+use constant MODE_INVALID    => 0;
+use constant MODE_ADD_UPDATE => 1;
+use constant MODE_REMOVE     => 2;
 
 BEGIN {
 }
diff --git a/debian/changelog b/debian/changelog
index f951ea0f..b04c120c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -303,6 +303,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium
       in-depth examination of program options parsing.
     - x2goserver/lib/x2goupdateoptionsstring: add mode selection
       functionality.
+    - X2Go/Server/Agent/NX/Options.pm: port modes "enum" subs to the constant
+      pragma to make the code more consistent with the program wrapper.
   * 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