summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-12-13 10:21:04 -0800
committerChris Aniszczyk <caniszczyk@gmail.com>2010-12-13 16:01:39 -0600
commit5ac5871d16642bbb4b617adaded37f99dcd2fff8 (patch)
tree46457a39353f98632c0d934b7a7e780813fe7dff /org.eclipse.jgit
parent2bc13104a8ec2c31dc5198cf77d2cf261b8a44b8 (diff)
downloadjgit-5ac5871d16642bbb4b617adaded37f99dcd2fff8.tar.gz
jgit-5ac5871d16642bbb4b617adaded37f99dcd2fff8.zip
Simplify NoteParser use of prefix.length()
Sasa pointed out we only ever use the length here, so instead of holding onto the AbbreviatedObjectId, lets just hold onto the length as a primitive int. Change-Id: I2444f59f9fe5ddcaea4a3537d3f1064736ae3215 Signed-off-by: Shawn O. Pearce <spearce@spearce.org> CC: Sasa Zivkov <zivkov@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteParser.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteParser.java
index d916e351bc..11ef10ae70 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteParser.java
@@ -91,7 +91,7 @@ final class NoteParser extends CanonicalTreeParser {
return new NoteParser(prefix, reader, treeId).parse();
}
- private final AbbreviatedObjectId prefix;
+ private final int prefixLen;
private final int pathPadding;
@@ -99,16 +99,16 @@ final class NoteParser extends CanonicalTreeParser {
private NonNoteEntry lastNonNote;
- private NoteParser(AbbreviatedObjectId p, ObjectReader r, ObjectId t)
+ private NoteParser(AbbreviatedObjectId prefix, ObjectReader r, ObjectId t)
throws IncorrectObjectTypeException, IOException {
- super(encodeASCII(p.name()), r, t);
- prefix = p;
+ super(encodeASCII(prefix.name()), r, t);
+ prefixLen = prefix.length();
// Our path buffer has a '/' that we don't want after the prefix.
// Drop it by shifting the path down one position.
- pathPadding = 0 < prefix.length() ? 1 : 0;
+ pathPadding = 0 < prefixLen ? 1 : 0;
if (0 < pathPadding)
- System.arraycopy(path, 0, path, pathPadding, prefix.length());
+ System.arraycopy(path, 0, path, pathPadding, prefixLen);
}
private InMemoryNoteBucket parse() {
@@ -130,11 +130,11 @@ final class NoteParser extends CanonicalTreeParser {
}
// If we cannot determine the style used, assume its a leaf.
- return new LeafBucket(prefix.length());
+ return new LeafBucket(prefixLen);
}
private LeafBucket parseLeafTree() {
- final LeafBucket leaf = new LeafBucket(prefix.length());
+ final LeafBucket leaf = new LeafBucket(prefixLen);
final MutableObjectId idBuf = new MutableObjectId();
for (; !eof(); next(1)) {
@@ -160,7 +160,7 @@ final class NoteParser extends CanonicalTreeParser {
}
private FanoutBucket parseFanoutTree() {
- final FanoutBucket fanout = new FanoutBucket(prefix.length());
+ final FanoutBucket fanout = new FanoutBucket(prefixLen);
for (; !eof(); next(1)) {
final int cell = parseFanoutCell();