mirror of https://github.com/gogs/gogs.git
autofix: fix unnecessary allocations due to `strings.Index` call (#6806)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>pull/6811/head
parent
5afca6ca8e
commit
b7372b1f32
|
@ -67,8 +67,8 @@ func (r *MarkdownRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {
|
||||||
m := CommitPattern.Find(link)
|
m := CommitPattern.Find(link)
|
||||||
if m != nil {
|
if m != nil {
|
||||||
m = bytes.TrimSpace(m)
|
m = bytes.TrimSpace(m)
|
||||||
i := strings.Index(string(m), "commit/")
|
i := bytes.Index(m, []byte("commit/"))
|
||||||
j := strings.Index(string(m), "#")
|
j := bytes.Index(m, []byte("#"))
|
||||||
if j == -1 {
|
if j == -1 {
|
||||||
j = len(m)
|
j = len(m)
|
||||||
}
|
}
|
||||||
|
@ -79,8 +79,8 @@ func (r *MarkdownRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {
|
||||||
m = IssueFullPattern.Find(link)
|
m = IssueFullPattern.Find(link)
|
||||||
if m != nil {
|
if m != nil {
|
||||||
m = bytes.TrimSpace(m)
|
m = bytes.TrimSpace(m)
|
||||||
i := strings.Index(string(m), "issues/")
|
i := bytes.Index(m, []byte("issues/"))
|
||||||
j := strings.Index(string(m), "#")
|
j := bytes.Index(m, []byte("#"))
|
||||||
if j == -1 {
|
if j == -1 {
|
||||||
j = len(m)
|
j = len(m)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue