You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/02/25 18:06:55 UTC

[GitHub] [netbeans] matthiasblaesing commented on a change in pull request #1969: Attempt to fix potential issue with NbLexerCharStream(s)

matthiasblaesing commented on a change in pull request #1969: Attempt to fix potential issue with NbLexerCharStream(s)
URL: https://github.com/apache/netbeans/pull/1969#discussion_r384034030
 
 

 ##########
 File path: ide/css.lib/src/org/netbeans/modules/css/lib/nblexer/NbLexerCharStream.java
 ##########
 @@ -132,9 +132,9 @@ public void release(int marker) {
         }
         
         //remove all markers from the given one, including the requested one
-        for(int i = marker; i < markers.size(); i++) {
-            markers.remove(i);
-        }
+        do {
+            markers.remove(marker);
+        } while (marker < markers.size());
 
 Review comment:
   Independent of the implementation of the stack I would expect the `push` and `pop` operations to be the fastest operations. So instead of using the positional remove I'd use `markers.pop()` to remove the superfluous markers.
   
   Apart from that I'm ok with the change - if I'm not mistaken the original implementation would skip every second marker while deleting.

----------------------------------------------------------------
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: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists