[JGIT PATCH 02/13] Cleanup stupid release of the cached Inflater in IndexPack

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

 



The try/finally idiom avoids placing the Inflater on the stack,
which means it goes unreachable slightly faster.  Its also much
less obtuse to read.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 .../src/org/spearce/jgit/transport/IndexPack.java  |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
index 2752bb0..3e2187c 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
@@ -320,9 +320,11 @@ public void index(final ProgressMonitor progress) throws IOException {
 					writeIdx();
 
 			} finally {
-				final Inflater inf = inflater;
-				inflater = null;
-				InflaterCache.release(inf);
+				try {
+					InflaterCache.release(inflater);
+				} finally {
+					inflater = null;
+				}
 
 				progress.endTask();
 				if (packOut != null)
-- 
1.6.1.rc4.301.g5497a

--
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]

  Powered by Linux