Re: [JGIT PATCH] Support for delegating tree iterators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Constantine Plotnikov <constantine.plotnikov@xxxxxxxxx> wrote:
> This patch introduce some methods that simplify creation of tree
> iterators that wraps other iterators and which are located in
> other package. Such iterators need to efficiently access the
> name component of the path of wrapped iterator and wrapped bits.
> The patch also adds a method that ensuring that path buffer has
> a requried capacity when the required capacity is known in advance.
> 
> Signed-off-by: Constantine Plotnikov <constantine.plotnikov@xxxxxxxxx>

Thanks, two style nits, I fixed during apply:

diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/AbstractTreeIterator.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/AbstractTreeIterator.java
index 2fe756e..50befbe 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/treewalk/AbstractTreeIterator.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/AbstractTreeIterator.java
@@ -264,15 +264,13 @@ protected void growPath(final int len) {
 	 *            the amount of live bytes in path buffer
 	 */
 	protected void ensurePathCapacity(final int capacity, final int len) {
-		if(path.length >= capacity) {
+		if (path.length >= capacity)
 			return;
-		}
 		final byte[] o = path;
 		int current = o.length;
 		int newCapacity = current;
-		while(newCapacity < capacity && newCapacity > 0) {
+		while (newCapacity < capacity && newCapacity > 0)
 			newCapacity <<= 1;
-		}
 		setPathCapacity(newCapacity, len);
 	}
 
> ---
> Note that WorkingTreeIterator.parseEntry is possibly might be a good 
> place to use ensurePathCapacity(...) instead or growPath(...).

Yes.  I'll send a change shortly.
   
-- 
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]