aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/strings/strings.go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-11-06 19:49:01 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-11-06 19:49:01 +0000
commitf038dae646bac2b31be98ab592c0e5206d2d96f5 (patch)
tree39530b071991b2326f881b2a30a2d82d6c133fd6 /libgo/go/strings/strings.go
parentf20f261304993444741e0f0a14d3147e591bc660 (diff)
downloadgcc-f038dae646bac2b31be98ab592c0e5206d2d96f5.zip
gcc-f038dae646bac2b31be98ab592c0e5206d2d96f5.tar.gz
gcc-f038dae646bac2b31be98ab592c0e5206d2d96f5.tar.bz2
libgo: Update to October 24 version of master library.
From-SVN: r204466
Diffstat (limited to 'libgo/go/strings/strings.go')
-rw-r--r--libgo/go/strings/strings.go14
1 files changed, 2 insertions, 12 deletions
diff --git a/libgo/go/strings/strings.go b/libgo/go/strings/strings.go
index 986f6d6..5d46211 100644
--- a/libgo/go/strings/strings.go
+++ b/libgo/go/strings/strings.go
@@ -130,14 +130,7 @@ func Index(s, sep string) int {
case n == 0:
return 0
case n == 1:
- c := sep[0]
- // special case worth making fast
- for i := 0; i < len(s); i++ {
- if s[i] == c {
- return i
- }
- }
- return -1
+ return IndexByte(s, sep[0])
case n == len(s):
if sep == s {
return 0
@@ -432,10 +425,7 @@ func Repeat(s string, count int) string {
b := make([]byte, len(s)*count)
bp := 0
for i := 0; i < count; i++ {
- for j := 0; j < len(s); j++ {
- b[bp] = s[j]
- bp++
- }
+ bp += copy(b[bp:], s)
}
return string(b)
}