use append

R=gri, r, r2
CC=golang-dev
https://golang.org/cl/2743042
This commit is contained in:
Russ Cox 2010-10-27 19:47:23 -07:00
parent d8b5d039cd
commit 69c4e9380b
32 changed files with 109 additions and 404 deletions

View file

@ -545,7 +545,7 @@ func resize(n int) int {
// Add appends the contents of t to the end of s and returns the result.
// If s has enough capacity, it is extended in place; otherwise a
// new array is allocated and returned.
func Add(s, t []byte) []byte {
func Add(s, t []byte) []byte { // TODO
lens := len(s)
lent := len(t)
if lens+lent <= cap(s) {
@ -562,7 +562,7 @@ func Add(s, t []byte) []byte {
// AddByte appends byte t to the end of s and returns the result.
// If s has enough capacity, it is extended in place; otherwise a
// new array is allocated and returned.
func AddByte(s []byte, t byte) []byte {
func AddByte(s []byte, t byte) []byte { // TODO
lens := len(s)
if lens+1 <= cap(s) {
s = s[0 : lens+1]