Commit 688a6ff7 authored by Robert Griesemer's avatar Robert Griesemer

gofmt-ify bytes

R=r
http://go/go-review/1016044
parent 789b31a4
...@@ -46,7 +46,7 @@ func (b *Buffer) Bytes() []byte { ...@@ -46,7 +46,7 @@ func (b *Buffer) Bytes() []byte {
func (b *Buffer) String() string { func (b *Buffer) String() string {
if b == nil { if b == nil {
// Special case, useful in debugging. // Special case, useful in debugging.
return "<nil>" return "<nil>";
} }
return string(b.buf[b.off : len(b.buf)]); return string(b.buf[b.off : len(b.buf)]);
} }
......
...@@ -142,7 +142,7 @@ func genSplit(s, sep []byte, sepSave, n int) [][]byte { ...@@ -142,7 +142,7 @@ func genSplit(s, sep []byte, sepSave, n int) [][]byte {
na := 0; na := 0;
for i := 0; i+len(sep) <= len(s) && na+1 < n; i++ { for i := 0; i+len(sep) <= len(s) && na+1 < n; i++ {
if s[i] == c && (len(sep) == 1 || Equal(s[i : i+len(sep)], sep)) { if s[i] == c && (len(sep) == 1 || Equal(s[i : i+len(sep)], sep)) {
a[na] = s[start:i+sepSave]; a[na] = s[start : i+sepSave];
na++; na++;
start = i+len(sep); start = i+len(sep);
i += len(sep)-1; i += len(sep)-1;
...@@ -278,7 +278,8 @@ func TrimSpace(s []byte) []byte { ...@@ -278,7 +278,8 @@ func TrimSpace(s []byte) []byte {
rune := int(s[end-1]); rune := int(s[end-1]);
if rune >= utf8.RuneSelf { if rune >= utf8.RuneSelf {
// Back up carefully looking for beginning of rune. Mustn't pass start. // Back up carefully looking for beginning of rune. Mustn't pass start.
for wid = 2; start <= end-wid && !utf8.RuneStart(s[end-wid]); wid++ {} for wid = 2; start <= end-wid && !utf8.RuneStart(s[end-wid]); wid++ {
}
if start > end-wid { // invalid UTF-8 sequence; stop processing if start > end-wid { // invalid UTF-8 sequence; stop processing
return s[start:end]; return s[start:end];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment