aboutsummaryrefslogtreecommitdiff
path: root/src/bytes/bytes.go
diff options
context:
space:
mode:
authorEric Lagergren <ericscottlagergren@gmail.com>2017-04-03 16:08:13 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2017-04-03 23:30:36 +0000
commit59f6549d1c7e0e074472c46f55716267225f4fd6 (patch)
treebe763b4e9fd6cd8529a5c13552fb628e7ed53893 /src/bytes/bytes.go
parent42426ed41167d6a99cfc9e5a91a4aff1b95093ca (diff)
downloadgo-59f6549d1c7e0e074472c46f55716267225f4fd6.tar.xz
bytes, strings: declare variables inside loop they're used in
The recently updated Count functions declare variables before special-cased returns. Change-Id: I8f726118336b7b0ff72117d12adc48b6e37e60ea Reviewed-on: https://go-review.googlesource.com/39357 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/bytes/bytes.go')
-rw-r--r--src/bytes/bytes.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go
index de3bd0515a..7c878af688 100644
--- a/src/bytes/bytes.go
+++ b/src/bytes/bytes.go
@@ -48,11 +48,11 @@ func explode(s []byte, n int) [][]byte {
// countGeneric actually implements Count
func countGeneric(s, sep []byte) int {
- n := 0
// special case
if len(sep) == 0 {
return utf8.RuneCount(s) + 1
}
+ n := 0
for {
i := Index(s, sep)
if i == -1 {