Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
cf0e2243
Commit
cf0e2243
authored
May 01, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vector: use correct capacity in call to make
R=gri, r, bflm CC=golang-dev
https://golang.org/cl/1032043
parent
58e77990
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
intvector.go
src/pkg/container/vector/intvector.go
+4
-3
stringvector.go
src/pkg/container/vector/stringvector.go
+4
-3
vector.go
src/pkg/container/vector/vector.go
+3
-0
No files found.
src/pkg/container/vector/intvector.go
View file @
cf0e2243
...
...
@@ -12,6 +12,9 @@ func (p *IntVector) realloc(length, capacity int) (b []int) {
if
capacity
<
initialSize
{
capacity
=
initialSize
}
if
capacity
<
length
{
capacity
=
length
}
b
=
make
(
IntVector
,
length
,
capacity
)
copy
(
b
,
*
p
)
*
p
=
b
...
...
@@ -186,9 +189,7 @@ func (p *IntVector) Pop() int {
// AppendVector appends the entire vector x to the end of this vector.
func
(
p
*
IntVector
)
AppendVector
(
x
*
IntVector
)
{
p
.
InsertVector
(
len
(
*
p
),
x
)
}
func
(
p
*
IntVector
)
AppendVector
(
x
*
IntVector
)
{
p
.
InsertVector
(
len
(
*
p
),
x
)
}
// Swap exchanges the elements at indexes i and j.
...
...
src/pkg/container/vector/stringvector.go
View file @
cf0e2243
...
...
@@ -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.
...
...
src/pkg/container/vector/vector.go
View file @
cf0e2243
...
...
@@ -12,6 +12,9 @@ func (p *Vector) realloc(length, capacity int) (b []interface{}) {
if
capacity
<
initialSize
{
capacity
=
initialSize
}
if
capacity
<
length
{
capacity
=
length
}
b
=
make
(
Vector
,
length
,
capacity
)
copy
(
b
,
*
p
)
*
p
=
b
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment