From c00295d1158b4851c5efad739331d219f6ee01f2 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 24 Nov 2008 13:29:59 -0800 Subject: [PATCH] Automated g4 rollback of changelist 19913. *** Reason for rollback *** broke build *** Original change description *** bufio.ReadRune TBR=r OCL=19923 CL=19923 --- src/lib/bufio.go | 34 +++------------------------------- src/lib/utf8.go | 1 - 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/src/lib/bufio.go b/src/lib/bufio.go index 11813d6c646..f41c4cd3d28 100644 --- a/src/lib/bufio.go +++ b/src/lib/bufio.go @@ -3,12 +3,8 @@ // license that can be found in the LICENSE file. package bufio - -import ( - "os"; - "io"; - "utf8"; -) +import "os" +import "io" // TODO: @@ -69,7 +65,7 @@ func (b *BufRead) Fill() *os.Error { } // Slide existing data to beginning. - if b.w > b.r { + if b.w > b.r { CopySlice(b.buf[0:b.w-b.r], b.buf[b.r:b.w]); b.w -= b.r; } else { @@ -144,30 +140,6 @@ func (b *BufRead) UnreadByte() *os.Error { return nil } -// Read a single Unicode character; returns the rune and its size. -func (b *BufRead) ReadRune() (rune int, size int, err *os.Error) { - for b.r + utf8.UTFMax > b.w && !utf8.FullRune(b.buf[b.r:b.w]) { - n := b.w - b.r; - b.Fill(); - if b.err != nil { - return 0, 0, b.err - } - if b.w - b.r == n { - // no bytes read - if b.r == b.w { - return 0, 0, EndOfFile - } - break; - } - } - rune, size = int(b.buf[b.r]), 1; - if rune >= 0x80 { - rune, size = utf8.DecodeRune(b.buf[b.r:b.w]); - } - b.r += size; - return rune, size, nil -} - // Helper function: look for byte c in array p, // returning its index or -1. func FindByte(p *[]byte, c byte) int { diff --git a/src/lib/utf8.go b/src/lib/utf8.go index 1375e8e50c5..7b0f15d8f70 100644 --- a/src/lib/utf8.go +++ b/src/lib/utf8.go @@ -7,7 +7,6 @@ package utf8 export const ( - UTFMax = 4; RuneError = 0xFFFD; RuneSelf = 0x80; RuneMax = 1<<21 - 1;