]> Cypherpunks repositories - gostls13.git/commit
internal/stringslite: remove duplicate code in Index
authorОлег Световидов <olegsvetovidov@gmail.com>
Tue, 3 Feb 2026 08:02:27 +0000 (11:02 +0300)
committerGopher Robot <gobot@golang.org>
Wed, 4 Feb 2026 20:19:11 +0000 (12:19 -0800)
commit044fe174d7a45ab0c7872500de63e6c61b01bf27
treede912d908ae814d89b7ec9101d380ea48df045bd
parentf766b8da6c6e78bfbd549931ad44e0a2386a32ba
internal/stringslite: remove duplicate code in Index

Merge two nearly identical loops into one by selecting the fallback
method (IndexString vs IndexRabinKarp) inside the loop based on
whether n <= bytealg.MaxLen.

Fixes #77364#

Change-Id: Iefbef60922ca24e4dda3016127f54290096bcfed
Reviewed-on: https://go-review.googlesource.com/c/go/+/741340
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/internal/stringslite/strings.go