From c861f30835090bbd6b9b35a80667f26952843767 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 20 Nov 2009 11:45:05 -0800 Subject: gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R=r, gri CC=golang-dev http://codereview.appspot.com/156115 --- src/pkg/regexp/regexp.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/pkg/regexp/regexp.go') diff --git a/src/pkg/regexp/regexp.go b/src/pkg/regexp/regexp.go index 30043fcb9..8f17954d7 100644 --- a/src/pkg/regexp/regexp.go +++ b/src/pkg/regexp/regexp.go @@ -265,7 +265,7 @@ func (p *parser) nextc() int { if p.pos >= len(p.re.expr) { p.ch = endOfFile } else { - c, w := utf8.DecodeRuneInString(p.re.expr[p.pos:len(p.re.expr)]); + c, w := utf8.DecodeRuneInString(p.re.expr[p.pos:]); p.ch = c; p.pos += w; } @@ -804,9 +804,9 @@ func (re *Regexp) doExecute(str string, bytestr []byte, pos int) []int { if re.prefix != "" { var advance int; if bytestr == nil { - advance = strings.Index(str[pos:len(str)], re.prefix) + advance = strings.Index(str[pos:], re.prefix) } else { - advance = bytes.Index(bytestr[pos:len(bytestr)], re.prefixBytes) + advance = bytes.Index(bytestr[pos:], re.prefixBytes) } if advance == -1 { return []int{} @@ -1014,7 +1014,7 @@ func (re *Regexp) ReplaceAllString(src, repl string) string { lastMatchEnd = a[1]; // Advance past this match; always advance at least one character. - _, width := utf8.DecodeRuneInString(src[searchPos:len(src)]); + _, width := utf8.DecodeRuneInString(src[searchPos:]); if searchPos+width > a[1] { searchPos += width } else if searchPos+1 > a[1] { @@ -1027,7 +1027,7 @@ func (re *Regexp) ReplaceAllString(src, repl string) string { } // Copy the unmatched characters after the last match. - io.WriteString(buf, src[lastMatchEnd:len(src)]); + io.WriteString(buf, src[lastMatchEnd:]); return buf.String(); } @@ -1058,7 +1058,7 @@ func (re *Regexp) ReplaceAll(src, repl []byte) []byte { lastMatchEnd = a[1]; // Advance past this match; always advance at least one character. - _, width := utf8.DecodeRune(src[searchPos:len(src)]); + _, width := utf8.DecodeRune(src[searchPos:]); if searchPos+width > a[1] { searchPos += width } else if searchPos+1 > a[1] { @@ -1071,7 +1071,7 @@ func (re *Regexp) ReplaceAll(src, repl []byte) []byte { } // Copy the unmatched characters after the last match. - buf.Write(src[lastMatchEnd:len(src)]); + buf.Write(src[lastMatchEnd:]); return buf.Bytes(); } -- cgit v1.2.3