exp/locale/collate/build: fixed bug that was exposed by experimenting

with table changes.
NOTE: there is no test for this, but 1) the code has now the same
control flow as scan in exp/locale/collate/contract.go, which is
tested and 2) Builder verifies the generated table so bugs in this
code are quickly and easily found (which is how this bug was discovered).

R=r
CC=golang-dev
https://golang.org/cl/6461082
This commit is contained in:
Marcel van Lohuizen 2012-08-20 10:56:41 +02:00
parent 98883c811a
commit a8357f0160

View File

@ -241,8 +241,8 @@ func (ct *contractTrieSet) lookup(h ctHandle, str []byte) (index, ns int) {
e := states[i]
c := str[p]
if c >= e.l {
p++
if e.l == c {
p++
if e.i != noIndex {
index, ns = int(e.i), p
}
@ -252,12 +252,13 @@ func (ct *contractTrieSet) lookup(h ctHandle, str []byte) (index, ns int) {
} else {
return
}
continue
} else if e.n == final && c <= e.h {
p++
return int(c-e.l) + int(e.i), p
}
} else {
i++
}
i++
}
return
}