]> Cypherpunks repositories - gostls13.git/commit
strings: fix Replacer bug with prefix matches
authorBrad Fitzpatrick <bradfitz@golang.org>
Thu, 24 Oct 2013 22:51:19 +0000 (15:51 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 24 Oct 2013 22:51:19 +0000 (15:51 -0700)
commit2d6a13997a9e9b154b7761d41cdbc830e02fc18e
treed1c759b101cc7bc213a7a501eaf21966728bc2ab
parent17a03d86508fea470d4d55d64e3936cc44e5ed1b
strings: fix Replacer bug with prefix matches

singleStringReplacer had a bug where if a string was replaced
at the beginning and no output had yet been produced into the
temp buffer before matching ended, an invalid nil check (used
as a proxy for having matched anything) meant it always
returned its input.

Fixes #6659

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/16880043
src/pkg/strings/replace.go
src/pkg/strings/replace_test.go