Skip to content

Commit

Permalink
buffer: save offset
Browse files Browse the repository at this point in the history
  • Loading branch information
julienschmidt committed Oct 25, 2013
1 parent 7e1b91b commit 620bcdd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ func (b *buffer) readNext(need int) ([]byte, error) {
}
}

offset := b.idx
b.idx += need
b.length -= need
return b.buf[b.idx-need : b.idx], nil
return b.buf[offset:b.idx], nil
}

// returns a buffer with the requested size.
Expand Down

0 comments on commit 620bcdd

Please sign in to comment.