You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/12/28 16:04:12 UTC

[commons-bcel] branch master updated (668f80bb -> 7a991770)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git


    from 668f80bb Bump ossf/scorecard-action from 2.1.0 to 2.1.2 (#194)
     new ff9a4bba Use Arrays.copyOf()
     new 7a991770 Use Arrays.copyOfRange()

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/main/java/org/apache/bcel/generic/ConstantPoolGen.java | 7 +++----
 src/main/java/org/apache/bcel/generic/InstructionList.java | 3 +--
 2 files changed, 4 insertions(+), 6 deletions(-)


[commons-bcel] 02/02: Use Arrays.copyOfRange()

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git

commit 7a991770365530648b4d26fa8f5caeaefe95fb14
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Wed Dec 28 11:04:08 2022 -0500

    Use Arrays.copyOfRange()
---
 src/main/java/org/apache/bcel/generic/InstructionList.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/bcel/generic/InstructionList.java b/src/main/java/org/apache/bcel/generic/InstructionList.java
index 86abcfa2..4dc9a634 100644
--- a/src/main/java/org/apache/bcel/generic/InstructionList.java
+++ b/src/main/java/org/apache/bcel/generic/InstructionList.java
@@ -1149,8 +1149,7 @@ public class InstructionList implements Iterable<InstructionHandle> {
             pos[count++] = index;
             index += i.getLength();
         }
-        bytePositions = new int[count]; // Trim to proper size
-        System.arraycopy(pos, 0, bytePositions, 0, count);
+        bytePositions = Arrays.copyOfRange(pos, 0, count); // Trim to proper size
     }
 
     /**


[commons-bcel] 01/02: Use Arrays.copyOf()

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git

commit ff9a4bba813b384ef0644552b9dc3263ecbc1ca0
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Wed Dec 28 11:03:58 2022 -0500

    Use Arrays.copyOf()
---
 src/main/java/org/apache/bcel/generic/ConstantPoolGen.java | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java b/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java
index 68feb64f..0dc45781 100644
--- a/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java
+++ b/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java
@@ -105,9 +105,8 @@ public class ConstantPoolGen {
         final StringBuilder sb = new StringBuilder(DEFAULT_BUFFER_SIZE);
 
         size = Math.min(Math.max(DEFAULT_BUFFER_SIZE, cs.length + 64), Const.MAX_CP_ENTRIES + 1);
-        constants = new Constant[size];
+        constants = Arrays.copyOf(cs, size);
 
-        System.arraycopy(cs, 0, constants, 0, cs.length);
         if (cs.length > 0) {
             index = cs.length;
         }
@@ -538,12 +537,12 @@ public class ConstantPoolGen {
         }
 
         if (index + 3 >= size) {
-            final Constant[] cs = constants;
+            final Constant[] tmp = constants;
             size *= 2;
             // the constant array shall not exceed the size of the constant pool
             size = Math.min(size, Const.MAX_CP_ENTRIES + 1);
             constants = new Constant[size];
-            System.arraycopy(cs, 0, constants, 0, index);
+            System.arraycopy(tmp, 0, constants, 0, index);
         }
     }