diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-12-03 02:17:34 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-12-03 02:17:34 +0000 |
commit | 2fd401c8f190f1fe43e51a7f726f6ed6119a1f96 (patch) | |
tree | 7f76eff391f37fe6467ff4ffbc0c582c9959ea30 /libgo/go/index | |
parent | 02e9018f1616b23f1276151797216717b3564202 (diff) | |
download | gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.zip gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.tar.gz gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.tar.bz2 |
libgo: Update to weekly.2011-11-02.
From-SVN: r181964
Diffstat (limited to 'libgo/go/index')
-rw-r--r-- | libgo/go/index/suffixarray/suffixarray.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libgo/go/index/suffixarray/suffixarray.go b/libgo/go/index/suffixarray/suffixarray.go index 174460c..c59ae6e 100644 --- a/libgo/go/index/suffixarray/suffixarray.go +++ b/libgo/go/index/suffixarray/suffixarray.go @@ -20,7 +20,6 @@ import ( "bytes" "encoding/binary" "io" - "os" "regexp" "sort" ) @@ -38,14 +37,14 @@ func New(data []byte) *Index { } // writeInt writes an int x to w using buf to buffer the write. -func writeInt(w io.Writer, buf []byte, x int) os.Error { +func writeInt(w io.Writer, buf []byte, x int) error { binary.PutVarint(buf, int64(x)) _, err := w.Write(buf[0:binary.MaxVarintLen64]) return err } // readInt reads an int x from r using buf to buffer the read and returns x. -func readInt(r io.Reader, buf []byte) (int, os.Error) { +func readInt(r io.Reader, buf []byte) (int, error) { _, err := io.ReadFull(r, buf[0:binary.MaxVarintLen64]) // ok to continue with error x, _ := binary.Varint(buf) return int(x), err @@ -53,7 +52,7 @@ func readInt(r io.Reader, buf []byte) (int, os.Error) { // writeSlice writes data[:n] to w and returns n. // It uses buf to buffer the write. -func writeSlice(w io.Writer, buf []byte, data []int) (n int, err os.Error) { +func writeSlice(w io.Writer, buf []byte, data []int) (n int, err error) { // encode as many elements as fit into buf p := binary.MaxVarintLen64 for ; n < len(data) && p+binary.MaxVarintLen64 <= len(buf); n++ { @@ -70,7 +69,7 @@ func writeSlice(w io.Writer, buf []byte, data []int) (n int, err os.Error) { // readSlice reads data[:n] from r and returns n. // It uses buf to buffer the read. -func readSlice(r io.Reader, buf []byte, data []int) (n int, err os.Error) { +func readSlice(r io.Reader, buf []byte, data []int) (n int, err error) { // read buffer size var size int size, err = readInt(r, buf) @@ -96,7 +95,7 @@ func readSlice(r io.Reader, buf []byte, data []int) (n int, err os.Error) { const bufSize = 16 << 10 // reasonable for BenchmarkSaveRestore // Read reads the index from r into x; x must not be nil. -func (x *Index) Read(r io.Reader) os.Error { +func (x *Index) Read(r io.Reader) error { // buffer for all reads buf := make([]byte, bufSize) @@ -135,7 +134,7 @@ func (x *Index) Read(r io.Reader) os.Error { } // Write writes the index x to w. -func (x *Index) Write(w io.Writer) os.Error { +func (x *Index) Write(w io.Writer) error { // buffer for all writes buf := make([]byte, bufSize) |