From: Carsten W. <ca...@us...> - 2005-01-17 21:54:53
|
Update of /cvsroot/jake2/jake2/src/jake2/qcommon In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22355/src/jake2/qcommon Modified Files: Cbuf.java Log Message: garbage optimized with static buffers Index: Cbuf.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/Cbuf.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Cbuf.java 22 Sep 2004 19:22:09 -0000 1.5 --- Cbuf.java 17 Jan 2005 21:54:38 -0000 1.6 *************** *** 36,39 **** --- 36,42 ---- public final class Cbuf { + private static final byte[] line = new byte[1024]; + private static final byte[] tmp = new byte[8192]; + /** * *************** *** 46,50 **** public static void InsertText(String text) { - byte[] temp = null; int templen = 0; --- 49,52 ---- *************** *** 52,57 **** templen = Globals.cmd_text.cursize; if (templen != 0) { ! temp = new byte[templen]; ! System.arraycopy(Globals.cmd_text.data, 0, temp, 0, templen); SZ.Clear(Globals.cmd_text); } --- 54,58 ---- templen = Globals.cmd_text.cursize; if (templen != 0) { ! System.arraycopy(Globals.cmd_text.data, 0, tmp, 0, templen); SZ.Clear(Globals.cmd_text); } *************** *** 62,67 **** // add the copied off data if (templen != 0) { ! SZ.Write(Globals.cmd_text, temp, templen); ! temp = null; } } --- 63,67 ---- // add the copied off data if (templen != 0) { ! SZ.Write(Globals.cmd_text, tmp, templen); } } *************** *** 157,161 **** byte[] text = null; - byte[] line = new byte[1024]; Globals.alias_count = 0; // don't allow infinite alias loops --- 157,160 ---- *************** *** 191,195 **** i++; Globals.cmd_text.cursize -= i; ! byte[] tmp = new byte[Globals.cmd_text.cursize]; System.arraycopy(text, i, tmp, 0, Globals.cmd_text.cursize); --- 190,194 ---- i++; Globals.cmd_text.cursize -= i; ! //byte[] tmp = new byte[Globals.cmd_text.cursize]; System.arraycopy(text, i, tmp, 0, Globals.cmd_text.cursize); |