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 var seg []int
for _, m := range self.Matchers { 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 { if idx == -1 {
continue continue
} }

View File

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