Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert three variable assignments to the usage of combined operators #8

Open
elfring opened this issue Nov 27, 2021 · 0 comments
Open

Comments

@elfring
Copy link

elfring commented Nov 27, 2021

👀 Some source code analysis tools can help to find opportunities for improving software components.
💭 I propose to increase the usage of combined operators accordingly.

diff --git a/Sldb.pm b/Sldb.pm
index 32fa3d9..872bec1 100644
--- a/Sldb.pm
+++ b/Sldb.pm
@@ -1502,7 +1502,7 @@ sub getFirstRangeAddr {
 # Called by computeAllUserIps()
 sub getLastRangeAddr {
   my $ip=shift;
-  $ip=$ip-($ip%256)+255;
+  $ip -= ($ip%256) - 255;
   return $ip;
 }
 
diff --git a/slMonitor.pl b/slMonitor.pl
index 3186ec3..13e81ed 100755
--- a/slMonitor.pl
+++ b/slMonitor.pl
@@ -555,7 +555,7 @@ sub getFirstRangeAddr {
 
 sub getLastRangeAddr {
   my $ip=shift;
-  $ip=$ip-($ip%256)+255;
+  $ip -= ($ip%256) - 255;
   return $ip;
 }
 
diff --git a/sldbLi.pl b/sldbLi.pl
index d9a761e..613f5dc 100755
--- a/sldbLi.pl
+++ b/sldbLi.pl
@@ -450,7 +450,7 @@ sub formatArray {
       $title="[$title]";
       $title=(' ' x int(($rowLength-realLength($title))/2)).$title.(' ' x ceil(($rowLength-realLength($title))/2));
     }else{
-      $title=$title.':';
+      $title .= ':';
     }
     unshift(@rows,$title);
   }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant