mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-04 08:17:24 -05:00
Reduce some allocations in type conversion (#26772)
This commit is contained in:
parent
4803766f7a
commit
ac2f8c9ac6
@ -90,7 +90,7 @@ func (b *EventWriterBaseImpl) Run(ctx context.Context) {
|
|||||||
|
|
||||||
if exprRegexp != nil {
|
if exprRegexp != nil {
|
||||||
fileLineCaller := fmt.Sprintf("%s:%d:%s", event.Origin.Filename, event.Origin.Line, event.Origin.Caller)
|
fileLineCaller := fmt.Sprintf("%s:%d:%s", event.Origin.Filename, event.Origin.Line, event.Origin.Caller)
|
||||||
matched := exprRegexp.Match([]byte(fileLineCaller)) || exprRegexp.Match([]byte(event.Origin.MsgSimpleText))
|
matched := exprRegexp.MatchString(fileLineCaller) || exprRegexp.MatchString(event.Origin.MsgSimpleText)
|
||||||
if !matched {
|
if !matched {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ func buildRepomd(pv *packages_model.PackageVersion, ownerID int64, data []*repoD
|
|||||||
}
|
}
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
buf.Write([]byte(xml.Header))
|
buf.WriteString(xml.Header)
|
||||||
if err := xml.NewEncoder(&buf).Encode(&Repomd{
|
if err := xml.NewEncoder(&buf).Encode(&Repomd{
|
||||||
Xmlns: "http://linux.duke.edu/metadata/repo",
|
Xmlns: "http://linux.duke.edu/metadata/repo",
|
||||||
XmlnsRpm: "http://linux.duke.edu/metadata/rpm",
|
XmlnsRpm: "http://linux.duke.edu/metadata/rpm",
|
||||||
|
@ -755,11 +755,11 @@ func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequ
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, author := range authors {
|
for _, author := range authors {
|
||||||
if _, err := stringBuilder.Write([]byte("Co-authored-by: ")); err != nil {
|
if _, err := stringBuilder.WriteString("Co-authored-by: "); err != nil {
|
||||||
log.Error("Unable to write to string builder Error: %v", err)
|
log.Error("Unable to write to string builder Error: %v", err)
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
if _, err := stringBuilder.Write([]byte(author)); err != nil {
|
if _, err := stringBuilder.WriteString(author); err != nil {
|
||||||
log.Error("Unable to write to string builder Error: %v", err)
|
log.Error("Unable to write to string builder Error: %v", err)
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user