[freenet-cvs] r11689 - trunk/freenet/src/freenet/node/fcp

toad at freenetproject.org toad at freenetproject.org
Wed Feb 7 22:42:33 UTC 2007


Author: toad
Date: 2007-02-07 22:42:31 +0000 (Wed, 07 Feb 2007)
New Revision: 11689

Modified:
   trunk/freenet/src/freenet/node/fcp/FCPServer.java
Log:
Save some more allocs

Modified: trunk/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPServer.java	2007-02-07 17:29:29 UTC (rev 11688)
+++ trunk/freenet/src/freenet/node/fcp/FCPServer.java	2007-02-07 22:42:31 UTC (rev 11689)
@@ -689,9 +689,14 @@
 		File f = new File(core.getDownloadDir(), preferredWithExt);
 		File f1 = new File(core.getDownloadDir(), preferredWithExt + ".freenet-tmp");
 		int x = 0;
-		while(f.exists() || f1.exists()) {
-			f = new File(core.getDownloadDir(), preferred + '-' + x + extAdd);
-			f1 = new File(core.getDownloadDir(), preferred + '-' + x + extAdd + ".freenet-tmp");
+		StringBuffer sb = new StringBuffer();
+		for(;f.exists() || f1.exists();sb.setLength(0)) {
+			sb.append(preferred);
+			sb.append('-');
+			sb.append(x);
+			sb.append(extAdd);
+			f = new File(core.getDownloadDir(), sb.toString());
+			f1 = new File(core.getDownloadDir(), sb.append(".freenet-tmp").toString());
 		}
 		return f;
 	}




More information about the cvs mailing list