You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by GitBox <gi...@apache.org> on 2020/04/07 16:30:46 UTC

[GitHub] [tomcat] larsgrefer opened a new pull request #272: Loop can be terminated after condition is met

larsgrefer opened a new pull request #272: Loop can be terminated after condition is met
URL: https://github.com/apache/tomcat/pull/272
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] michael-o commented on a change in pull request #272: Loop can be terminated after condition is met

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #272: Loop can be terminated after condition is met
URL: https://github.com/apache/tomcat/pull/272#discussion_r405110590
 
 

 ##########
 File path: java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
 ##########
 @@ -824,17 +824,23 @@ public void mapMemberAdded(Member member) {
     public boolean inSet(Member m, Member[] set) {
         if ( set == null ) return false;
         boolean result = false;
-        for (int i=0; i<set.length && (!result); i++ )
-            if ( m.equals(set[i]) ) result = true;
+        for (int i = 0; i < set.length; i++ )
 
 Review comment:
   Same here
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] michael-o commented on a change in pull request #272: Loop can be terminated after condition is met

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #272: Loop can be terminated after condition is met
URL: https://github.com/apache/tomcat/pull/272#discussion_r405110511
 
 

 ##########
 File path: java/org/apache/catalina/realm/RealmBase.java
 ##########
 @@ -756,10 +756,11 @@ public void backgroundProcess() {
                 }
 
                 boolean matched = false;
-                for(int k=0; k < patterns.length && !matched; k++) {
+                for(int k = 0; k < patterns.length; k++) {
 
 Review comment:
   Why not make it foreach directly?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] larsgrefer commented on a change in pull request #272: Loop can be terminated after condition is met

Posted by GitBox <gi...@apache.org>.
larsgrefer commented on a change in pull request #272: Loop can be terminated after condition is met
URL: https://github.com/apache/tomcat/pull/272#discussion_r405148102
 
 

 ##########
 File path: java/org/apache/catalina/realm/RealmBase.java
 ##########
 @@ -756,10 +756,11 @@ public void backgroundProcess() {
                 }
 
                 boolean matched = false;
-                for(int k=0; k < patterns.length && !matched; k++) {
+                for(int k = 0; k < patterns.length; k++) {
 
 Review comment:
   I wanted to make a separate PR for all possible foreach loops later

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] michael-o commented on a change in pull request #272: Loop can be terminated after condition is met

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #272: Loop can be terminated after condition is met
URL: https://github.com/apache/tomcat/pull/272#discussion_r405110647
 
 

 ##########
 File path: java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
 ##########
 @@ -824,17 +824,23 @@ public void mapMemberAdded(Member member) {
     public boolean inSet(Member m, Member[] set) {
         if ( set == null ) return false;
         boolean result = false;
-        for (int i=0; i<set.length && (!result); i++ )
-            if ( m.equals(set[i]) ) result = true;
+        for (int i = 0; i < set.length; i++ )
+            if (m.equals(set[i])) {
+                result = true;
+                break;
+            }
         return result;
     }
 
     public Member[] excludeFromSet(Member[] mbrs, Member[] set) {
         List<Member> result = new ArrayList<>();
         for (int i=0; i<set.length; i++ ) {
             boolean include = true;
-            for (int j=0; j<mbrs.length && include; j++ )
-                if ( mbrs[j].equals(set[i]) ) include = false;
+            for (int j = 0; j < mbrs.length; j++ )
 
 Review comment:
   And here..

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] larsgrefer commented on a change in pull request #272: Loop can be terminated after condition is met

Posted by GitBox <gi...@apache.org>.
larsgrefer commented on a change in pull request #272: Loop can be terminated after condition is met
URL: https://github.com/apache/tomcat/pull/272#discussion_r405473870
 
 

 ##########
 File path: java/org/apache/catalina/realm/RealmBase.java
 ##########
 @@ -756,10 +756,11 @@ public void backgroundProcess() {
                 }
 
                 boolean matched = false;
-                for(int k=0; k < patterns.length && !matched; k++) {
+                for(int k = 0; k < patterns.length; k++) {
 
 Review comment:
   see #273 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org