mirror of
https://github.com/golang/go
synced 2024-11-22 02:34:40 -07:00
replace custom findByte with bytes.IndexByte
R=rsc https://golang.org/cl/156093
This commit is contained in:
parent
bf1f63a273
commit
02df7db868
@ -1,12 +1,12 @@
|
||||
archive/tar.install: bytes.install io.install os.install strconv.install strings.install
|
||||
asn1.install: fmt.install os.install reflect.install strconv.install strings.install time.install
|
||||
asn1.install: bytes.install fmt.install io.install os.install reflect.install strconv.install strings.install time.install
|
||||
big.install: rand.install
|
||||
bignum.install: fmt.install
|
||||
bufio.install: io.install os.install strconv.install utf8.install
|
||||
bufio.install: bytes.install io.install os.install strconv.install utf8.install
|
||||
bytes.install: os.install unicode.install utf8.install
|
||||
compress/flate.install: bufio.install bytes.install io.install math.install os.install sort.install strconv.install
|
||||
compress/gzip.install: bufio.install compress/flate.install hash/crc32.install hash.install io.install os.install
|
||||
compress/zlib.install: bufio.install compress/flate.install hash/adler32.install hash.install io.install os.install
|
||||
compress/flate.install: bufio.install io.install math.install os.install sort.install strconv.install
|
||||
compress/gzip.install: bufio.install compress/flate.install hash.install hash/crc32.install io.install os.install
|
||||
compress/zlib.install: bufio.install compress/flate.install hash.install hash/adler32.install io.install os.install
|
||||
container/heap.install: sort.install
|
||||
container/list.install:
|
||||
container/ring.install:
|
||||
@ -16,19 +16,19 @@ crypto/block.install: fmt.install hash.install io.install os.install strconv.ins
|
||||
crypto/hmac.install: crypto/md5.install crypto/sha1.install hash.install os.install
|
||||
crypto/md5.install: hash.install os.install
|
||||
crypto/rc4.install: os.install strconv.install
|
||||
crypto/rsa.install: big.install bytes.install crypto/subtle.install hash.install io.install os.install
|
||||
crypto/rsa.install: big.install crypto/subtle.install hash.install io.install os.install
|
||||
crypto/sha1.install: hash.install os.install
|
||||
crypto/subtle.install:
|
||||
crypto/tls.install: bufio.install bytes.install container/list.install crypto/hmac.install crypto/md5.install crypto/rc4.install crypto/rsa.install crypto/sha1.install crypto/subtle.install crypto/x509.install fmt.install hash.install io.install net.install os.install strings.install time.install
|
||||
crypto/x509.install: asn1.install big.install container/vector.install crypto/rsa.install os.install time.install
|
||||
crypto/tls.install: bufio.install container/list.install crypto/hmac.install crypto/md5.install crypto/rc4.install crypto/rsa.install crypto/sha1.install crypto/subtle.install fmt.install hash.install io.install net.install os.install strings.install time.install
|
||||
crypto/x509.install: asn1.install big.install container/vector.install crypto/rsa.install crypto/sha1.install hash.install os.install strings.install time.install
|
||||
debug/dwarf.install: encoding/binary.install os.install strconv.install
|
||||
debug/macho.install: bytes.install debug/dwarf.install encoding/binary.install fmt.install io.install os.install strconv.install
|
||||
debug/elf.install: bytes.install debug/dwarf.install encoding/binary.install fmt.install io.install os.install strconv.install
|
||||
debug/gosym.install: encoding/binary.install fmt.install os.install strconv.install strings.install
|
||||
debug/proc.install: container/vector.install fmt.install io.install os.install runtime.install strconv.install strings.install sync.install syscall.install
|
||||
ebnf.install: container/vector.install go/scanner.install go/token.install os.install strconv.install unicode.install utf8.install
|
||||
encoding/ascii85.install: bytes.install io.install os.install strconv.install
|
||||
encoding/base64.install: bytes.install io.install os.install strconv.install
|
||||
encoding/ascii85.install: io.install os.install strconv.install
|
||||
encoding/base64.install: io.install os.install strconv.install
|
||||
encoding/binary.install: io.install math.install os.install reflect.install
|
||||
encoding/git85.install: bytes.install io.install os.install strconv.install
|
||||
encoding/hex.install: os.install strconv.install strings.install
|
||||
@ -52,7 +52,7 @@ hash/adler32.install: hash.install os.install
|
||||
hash/crc32.install: hash.install os.install
|
||||
http.install: bufio.install bytes.install container/vector.install fmt.install io.install log.install net.install os.install path.install strconv.install strings.install utf8.install
|
||||
image.install:
|
||||
image/png.install: bufio.install compress/zlib.install hash/crc32.install hash.install image.install io.install os.install strconv.install
|
||||
image/png.install: bufio.install compress/zlib.install hash.install hash/crc32.install image.install io.install os.install strconv.install
|
||||
io.install: bytes.install os.install sort.install strings.install sync.install
|
||||
json.install: bytes.install container/vector.install fmt.install math.install reflect.install strconv.install strings.install utf8.install
|
||||
log.install: fmt.install io.install os.install runtime.install time.install
|
||||
@ -76,7 +76,7 @@ syscall.install: sync.install
|
||||
tabwriter.install: bytes.install container/vector.install io.install os.install utf8.install
|
||||
template.install: bytes.install container/vector.install fmt.install io.install os.install reflect.install runtime.install strings.install
|
||||
testing.install: flag.install fmt.install os.install runtime.install utf8.install
|
||||
testing/iotest.install: bytes.install io.install log.install os.install
|
||||
testing/iotest.install: io.install log.install os.install
|
||||
testing/quick.install: flag.install fmt.install math.install os.install rand.install reflect.install strings.install
|
||||
testing/script.install: fmt.install os.install rand.install reflect.install strings.install
|
||||
time.install: io.install once.install os.install syscall.install
|
||||
|
@ -8,6 +8,7 @@
|
||||
package bufio
|
||||
|
||||
import (
|
||||
"bytes";
|
||||
"io";
|
||||
"os";
|
||||
"strconv";
|
||||
@ -193,17 +194,6 @@ func (b *Reader) ReadRune() (rune int, size int, err os.Error) {
|
||||
return rune, size, nil;
|
||||
}
|
||||
|
||||
// Helper function: look for byte c in array p,
|
||||
// returning its index or -1.
|
||||
func findByte(p []byte, c byte) int {
|
||||
for i := 0; i < len(p); i++ {
|
||||
if p[i] == c {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Buffered returns the number of bytes that can be read from the current buffer.
|
||||
func (b *Reader) Buffered() int { return b.w - b.r }
|
||||
|
||||
@ -219,7 +209,7 @@ func (b *Reader) Buffered() int { return b.w - b.r }
|
||||
// ReadSlice returns err != nil if and only if line does not end in delim.
|
||||
func (b *Reader) ReadSlice(delim byte) (line []byte, err os.Error) {
|
||||
// Look in buffer.
|
||||
if i := findByte(b.buf[b.r:b.w], delim); i >= 0 {
|
||||
if i := bytes.IndexByte(b.buf[b.r:b.w], delim); i >= 0 {
|
||||
line1 := b.buf[b.r : b.r+i+1];
|
||||
b.r += i + 1;
|
||||
return line1, nil;
|
||||
@ -237,7 +227,7 @@ func (b *Reader) ReadSlice(delim byte) (line []byte, err os.Error) {
|
||||
b.fill();
|
||||
|
||||
// Search new part of buffer
|
||||
if i := findByte(b.buf[n:b.w], delim); i >= 0 {
|
||||
if i := bytes.IndexByte(b.buf[n:b.w], delim); i >= 0 {
|
||||
line := b.buf[0 : n+i+1];
|
||||
b.r = n + i + 1;
|
||||
return line, nil;
|
||||
|
Loading…
Reference in New Issue
Block a user