diff options
author | Bryce McKinlay <bryce@albatross.co.nz> | 1999-07-26 02:51:44 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 1999-07-26 03:51:44 +0100 |
commit | 41296e2a2391863bdaa411bb67d8ac9af3e39fde (patch) | |
tree | 41653eeceacd1252434a7f1e6a81fc4ca6638997 /libjava/java/lang/natString.cc | |
parent | 648d2ffce89154a5c166258f6638ab32e737a2c6 (diff) | |
download | gcc-41296e2a2391863bdaa411bb67d8ac9af3e39fde.zip gcc-41296e2a2391863bdaa411bb67d8ac9af3e39fde.tar.gz gcc-41296e2a2391863bdaa411bb67d8ac9af3e39fde.tar.bz2 |
natString.cc (substring): optimize where substring is entire String.
1999-07-22 Bryce McKinlay <bryce@albatross.co.nz>
* java/lang/natString.cc (substring): optimize where substring is
entire String.
* java/io/File.java (getName): don't return separator with file name.
* java/io/natFile.cc (attr): fix overflow.
From-SVN: r28246
Diffstat (limited to 'libjava/java/lang/natString.cc')
-rw-r--r-- | libjava/java/lang/natString.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libjava/java/lang/natString.cc b/libjava/java/lang/natString.cc index 08f1755..bfdc50f 100644 --- a/libjava/java/lang/natString.cc +++ b/libjava/java/lang/natString.cc @@ -687,6 +687,8 @@ java::lang::String::substring (jint beginIndex, jint endIndex) { if (beginIndex < 0 || endIndex > count || beginIndex > endIndex) JvThrow (new StringIndexOutOfBoundsException()); + if (beginIndex == 0 && endIndex == count) + return this; jint newCount = endIndex - beginIndex; if (newCount <= 8) // Optimization, mainly for GC. return JvNewString(JvGetStringChars(this) + beginIndex, newCount); |