aboutsummaryrefslogtreecommitdiff
path: root/src/regexp
diff options
context:
space:
mode:
authorJes Cok <xigua67damn@gmail.com>2023-09-13 13:07:09 +0000
committerGopher Robot <gobot@golang.org>2023-09-14 17:25:39 +0000
commit02561981291600d901db7d4886147480cf3de332 (patch)
treec9313e0c2479f5be99dd45f143415fbc8c80c5b3 /src/regexp
parenta03f1aeb557e0e4547c7dfdc1bd64d1f6f3a56ec (diff)
downloadgo-02561981291600d901db7d4886147480cf3de332.tar.gz
go-02561981291600d901db7d4886147480cf3de332.zip
regexp: use built-in clear to clear b.visited in *bitState.reset
Change-Id: I1a723124f7050aeb971377db8c3cd04ebf9f7a16 GitHub-Last-Rev: 465da88feb20b4a3ebea3c3e36560f6c82f7fa2e GitHub-Pull-Request: golang/go#62611 Reviewed-on: https://go-review.googlesource.com/c/go/+/527975 Reviewed-by: qiulaidongfeng <2645477756@qq.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Heschi Kreinick <heschi@google.com>
Diffstat (limited to 'src/regexp')
-rw-r--r--src/regexp/backtrack.go4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/regexp/backtrack.go b/src/regexp/backtrack.go
index 0739f5ff58..7c37c66a80 100644
--- a/src/regexp/backtrack.go
+++ b/src/regexp/backtrack.go
@@ -91,9 +91,7 @@ func (b *bitState) reset(prog *syntax.Prog, end int, ncap int) {
b.visited = make([]uint32, visitedSize, maxBacktrackVector/visitedBits)
} else {
b.visited = b.visited[:visitedSize]
- for i := range b.visited {
- b.visited[i] = 0
- }
+ clear(b.visited) // set to 0
}
if cap(b.cap) < ncap {