mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
42426ed411
commit
59f6549d1c
2 changed files with 2 additions and 2 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue