This commit is contained in:
gobwas 2016-02-22 22:32:30 +03:00
parent 35629e8ad6
commit 205c640a14
2 changed files with 6 additions and 8 deletions

View File

@ -34,8 +34,7 @@ func (self AnyOf) Index(s string, segments []int) (int, []int) {
var seg []int
for _, m := range self.Matchers {
var idx int
idx, seg = m.Index(s, seg[:0])
idx, seg := m.Index(s, seg[:0])
if idx == -1 {
continue
}

View File

@ -83,12 +83,11 @@ func (self BTree) Match(s string) bool {
// reusable segments list
// inputLen is the maximum size of output segments values
segments := acquireSegments(inputLen)
defer func() {
releaseSegments(segments)
}()
// var segments []int
// segments := make([]int, 0, inputLen)
// segments := acquireSegments(inputLen)
// defer func() {
// releaseSegments(segments)
// }()
var segments []int
for offset < limit {
// search for matching part in substring