mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
xml: use io.ReadByter in place of local readByter
R=cemeyer, rsc CC=golang-dev https://golang.org/cl/809041
This commit is contained in:
parent
55b145e32a
commit
66dd26e967
1 changed files with 2 additions and 6 deletions
|
|
@ -107,10 +107,6 @@ type Directive []byte
|
||||||
|
|
||||||
func (d Directive) Copy() Directive { return Directive(makeCopy(d)) }
|
func (d Directive) Copy() Directive { return Directive(makeCopy(d)) }
|
||||||
|
|
||||||
type readByter interface {
|
|
||||||
ReadByte() (b byte, err os.Error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyToken returns a copy of a Token.
|
// CopyToken returns a copy of a Token.
|
||||||
func CopyToken(t Token) Token {
|
func CopyToken(t Token) Token {
|
||||||
switch v := t.(type) {
|
switch v := t.(type) {
|
||||||
|
|
@ -167,7 +163,7 @@ type Parser struct {
|
||||||
//
|
//
|
||||||
Entity map[string]string
|
Entity map[string]string
|
||||||
|
|
||||||
r readByter
|
r io.ReadByter
|
||||||
buf bytes.Buffer
|
buf bytes.Buffer
|
||||||
stk *stack
|
stk *stack
|
||||||
free *stack
|
free *stack
|
||||||
|
|
@ -194,7 +190,7 @@ func NewParser(r io.Reader) *Parser {
|
||||||
// Assume that if reader has its own
|
// Assume that if reader has its own
|
||||||
// ReadByte, it's efficient enough.
|
// ReadByte, it's efficient enough.
|
||||||
// Otherwise, use bufio.
|
// Otherwise, use bufio.
|
||||||
if rb, ok := r.(readByter); ok {
|
if rb, ok := r.(io.ReadByter); ok {
|
||||||
p.r = rb
|
p.r = rb
|
||||||
} else {
|
} else {
|
||||||
p.r = bufio.NewReader(r)
|
p.r = bufio.NewReader(r)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue