Skip to content

Commit

Permalink
fix StringReader.__init__ initialization of buf and pos
Browse files Browse the repository at this point in the history
  • Loading branch information
haya14busa committed Sep 14, 2016
1 parent 71f910d commit 1dc4167
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions go/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ func NewStringReader(lines []string) *StringReader {
func (self *StringReader) __init__(lines []string) {
size := 0
for _, l := range lines {
size += len(l)
size += len(l) + 1 // +1 for EOL
}
self.buf = make([]string, 0, size)
self.pos = make([]pos, 0, size)
self.pos = make([]pos, 0, size+1) // +1 for EOF
var lnum = 0
for lnum < len(lines) {
var col = 0
Expand Down

0 comments on commit 1dc4167

Please sign in to comment.