aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/container/vector/stringvector.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/container/vector/stringvector.go')
-rw-r--r--src/pkg/container/vector/stringvector.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/pkg/container/vector/stringvector.go b/src/pkg/container/vector/stringvector.go
index fad20f58a5..86563ca203 100644
--- a/src/pkg/container/vector/stringvector.go
+++ b/src/pkg/container/vector/stringvector.go
@@ -12,6 +12,9 @@ func (p *StringVector) realloc(length, capacity int) (b []string) {
if capacity < initialSize {
capacity = initialSize
}
+ if capacity < length {
+ capacity = length
+ }
b = make(StringVector, length, capacity)
copy(b, *p)
*p = b
@@ -186,9 +189,7 @@ func (p *StringVector) Pop() string {
// AppendVector appends the entire vector x to the end of this vector.
-func (p *StringVector) AppendVector(x *StringVector) {
- p.InsertVector(len(*p), x)
-}
+func (p *StringVector) AppendVector(x *StringVector) { p.InsertVector(len(*p), x) }
// Swap exchanges the elements at indexes i and j.