mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #111450 from HecarimV/fix-22072710
cleanup: omit redundant arguments in make call
This commit is contained in:
commit
f6e163fe27
@ -654,7 +654,7 @@ func (q Quantity) MarshalJSON() ([]byte, error) {
|
|||||||
copy(out[1:], q.s)
|
copy(out[1:], q.s)
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
result := make([]byte, int64QuantityExpectedBytes, int64QuantityExpectedBytes)
|
result := make([]byte, int64QuantityExpectedBytes)
|
||||||
result[0] = '"'
|
result[0] = '"'
|
||||||
number, suffix := q.CanonicalizeBytes(result[1:1])
|
number, suffix := q.CanonicalizeBytes(result[1:1])
|
||||||
// if the same slice was returned to us that we passed in, avoid another allocation by copying number into
|
// if the same slice was returned to us that we passed in, avoid another allocation by copying number into
|
||||||
|
@ -165,7 +165,7 @@ func (sh *suffixHandler) constructBytes(base, exponent int32, format Format) (s
|
|||||||
if exponent == 0 {
|
if exponent == 0 {
|
||||||
return nil, true
|
return nil, true
|
||||||
}
|
}
|
||||||
result := make([]byte, 8, 8)
|
result := make([]byte, 8)
|
||||||
result[0] = 'e'
|
result[0] = 'e'
|
||||||
number := strconv.AppendInt(result[1:1], int64(exponent), 10)
|
number := strconv.AppendInt(result[1:1], int64(exponent), 10)
|
||||||
if &result[1] == &number[0] {
|
if &result[1] == &number[0] {
|
||||||
|
@ -60,7 +60,7 @@ func (a *Allocator) Allocate(n uint64) []byte {
|
|||||||
}
|
}
|
||||||
// grow the buffer
|
// grow the buffer
|
||||||
size := uint64(2*cap(a.buf)) + n
|
size := uint64(2*cap(a.buf)) + n
|
||||||
a.buf = make([]byte, size, size)
|
a.buf = make([]byte, size)
|
||||||
a.buf = a.buf[:n]
|
a.buf = a.buf[:n]
|
||||||
return a.buf
|
return a.buf
|
||||||
}
|
}
|
||||||
@ -72,5 +72,5 @@ type SimpleAllocator struct{}
|
|||||||
var _ MemoryAllocator = &SimpleAllocator{}
|
var _ MemoryAllocator = &SimpleAllocator{}
|
||||||
|
|
||||||
func (sa *SimpleAllocator) Allocate(n uint64) []byte {
|
func (sa *SimpleAllocator) Allocate(n uint64) []byte {
|
||||||
return make([]byte, n, n)
|
return make([]byte, n)
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ type testAllocator struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ta *testAllocator) Allocate(n uint64) []byte {
|
func (ta *testAllocator) Allocate(n uint64) []byte {
|
||||||
ta.buf = make([]byte, n, n)
|
ta.buf = make([]byte, n)
|
||||||
ta.allocateCount++
|
ta.allocateCount++
|
||||||
return ta.buf
|
return ta.buf
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user