forked from forgejo/forgejo
More expansions in template repositories (#10021)
* Super expansion * Explain which features are in 1.11 vs 1.12 * Move imports Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
206a031b38
commit
28216bde46
18 changed files with 1818 additions and 84 deletions
25
vendor/github.com/huandu/xstrings/common.go
generated
vendored
Normal file
25
vendor/github.com/huandu/xstrings/common.go
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2015 Huan Du. All rights reserved.
|
||||
// Licensed under the MIT license that can be found in the LICENSE file.
|
||||
|
||||
package xstrings
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
)
|
||||
|
||||
const bufferMaxInitGrowSize = 2048
|
||||
|
||||
// Lazy initialize a buffer.
|
||||
func allocBuffer(orig, cur string) *bytes.Buffer {
|
||||
output := &bytes.Buffer{}
|
||||
maxSize := len(orig) * 4
|
||||
|
||||
// Avoid to reserve too much memory at once.
|
||||
if maxSize > bufferMaxInitGrowSize {
|
||||
maxSize = bufferMaxInitGrowSize
|
||||
}
|
||||
|
||||
output.Grow(maxSize)
|
||||
output.WriteString(orig[:len(orig)-len(cur)])
|
||||
return output
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue