소스 검색

all: prefer bytes.IndexByte over bytes.Index

bytes.IndexByte can be used wherever the second argument to
strings.Index is exactly one byte long, so we do that with this change.

This avoids generating unnecessary string symbols/converison and saves
a few calls to bytes.Index.

Change-Id: If31c775790e01edfece1169e398ad6a754fb4428
Reviewed-on: https://go-review.googlesource.com/66373
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
v1.2.3
Marvin Stenger 7 년 전
committed by Ian Lance Taylor
부모
커밋
d7983b094e
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. +1
    -1
      handshake_client_test.go

+ 1
- 1
handshake_client_test.go 파일 보기

@@ -85,7 +85,7 @@ func (o *opensslOutputSink) Write(data []byte) (n int, err error) {
o.all = append(o.all, data...)

for {
i := bytes.Index(o.line, []byte{'\n'})
i := bytes.IndexByte(o.line, '\n')
if i < 0 {
break
}


불러오는 중...
취소
저장