What do people think of this StringBuffer de-pessimization?
2004-02-24 Anthony Green <[EMAIL PROTECTED]>
* java/lang/StringBuffer.java: No need to NULL out remainder of
buffer since ensureCapacity_unsynchronized will have done this for
us.
Index: java/lang/StringBuffer.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/StringBuffer.java,v
retrieving revision 1.25
diff -c -p -r1.25 StringBuffer.java
*** java/lang/StringBuffer.java 18 Oct 2003 08:45:37 -0000 1.25
--- java/lang/StringBuffer.java 24 Feb 2004 15:57:28 -0000
***************
*** 1,5 ****
/* StringBuffer.java -- Growable strings
! Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
--- 1,6 ----
/* StringBuffer.java -- Growable strings
! Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
! Free Software Foundation, Inc.
This file is part of GNU Classpath.
*************** public final class StringBuffer implemen
*** 206,213 ****
throw new StringIndexOutOfBoundsException(newLength);
ensureCapacity_unsynchronized(newLength);
! while (count < newLength)
! value[count++] = '\0';
count = newLength;
}
--- 207,219 ----
throw new StringIndexOutOfBoundsException(newLength);
ensureCapacity_unsynchronized(newLength);
!
! /* If the StringBuffer just grew, then we know that value is newly
! allocated and the region between count and newLength is filled
! with '\0'. If the StringBuffer just shrunk, we don't do
! anything. No part of StringBuffer depends on padding out the
! rest of the StringBuffer with '\0'. */
!
count = newLength;
}
--
Anthony Green <[EMAIL PROTECTED]>
Red Hat, Inc.
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath