diff options
author | Rob Pike <r@golang.org> | 2009-04-17 00:08:24 -0700 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2009-04-17 00:08:24 -0700 |
commit | 3696e3e558a5be76b8af9698ff0e56719e47ec59 (patch) | |
tree | c20f34ec6f9dea967a511f65b239c5e8637fec8f /src/lib/io/pipe.go | |
parent | df02778ccda228c665179d0ff3dac77217ad6633 (diff) | |
download | golang-3696e3e558a5be76b8af9698ff0e56719e47ec59.tar.gz |
Step 1 of the Big Error Shift: make os.Error an interface and replace *os.Errors with os.Errors.
lib/template updated to use new setup; its clients also updated.
Step 2 will make os's error support internally much cleaner.
R=rsc
OCL=27586
CL=27586
Diffstat (limited to 'src/lib/io/pipe.go')
-rw-r--r-- | src/lib/io/pipe.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/io/pipe.go b/src/lib/io/pipe.go index 427717b09..446ec69bb 100644 --- a/src/lib/io/pipe.go +++ b/src/lib/io/pipe.go @@ -15,7 +15,7 @@ import ( type pipeReturn struct { n int; - err *os.Error; + err os.Error; } // Shared pipe structure. @@ -28,7 +28,7 @@ type pipe struct { cw chan pipeReturn; // ... and reads the n, err back from here. } -func (p *pipe) Read(data []byte) (n int, err *os.Error) { +func (p *pipe) Read(data []byte) (n int, err os.Error) { if p == nil || p.rclosed { return 0, os.EINVAL; } @@ -65,7 +65,7 @@ func (p *pipe) Read(data []byte) (n int, err *os.Error) { return n, nil; } -func (p *pipe) Write(data []byte) (n int, err *os.Error) { +func (p *pipe) Write(data []byte) (n int, err os.Error) { if p == nil || p.wclosed { return 0, os.EINVAL; } @@ -81,7 +81,7 @@ func (p *pipe) Write(data []byte) (n int, err *os.Error) { return res.n, res.err; } -func (p *pipe) CloseReader() *os.Error { +func (p *pipe) CloseReader() os.Error { if p == nil || p.rclosed { return os.EINVAL; } @@ -97,7 +97,7 @@ func (p *pipe) CloseReader() *os.Error { return nil; } -func (p *pipe) CloseWriter() *os.Error { +func (p *pipe) CloseWriter() os.Error { if p == nil || p.wclosed { return os.EINVAL; } @@ -127,14 +127,14 @@ type pipeRead struct { p *pipe; } -func (r *pipeRead) Read(data []byte) (n int, err *os.Error) { +func (r *pipeRead) Read(data []byte) (n int, err os.Error) { r.lock.Lock(); defer r.lock.Unlock(); return r.p.Read(data); } -func (r *pipeRead) Close() *os.Error { +func (r *pipeRead) Close() os.Error { r.lock.Lock(); defer r.lock.Unlock(); @@ -151,14 +151,14 @@ type pipeWrite struct { p *pipe; } -func (w *pipeWrite) Write(data []byte) (n int, err *os.Error) { +func (w *pipeWrite) Write(data []byte) (n int, err os.Error) { w.lock.Lock(); defer w.lock.Unlock(); return w.p.Write(data); } -func (w *pipeWrite) Close() *os.Error { +func (w *pipeWrite) Close() os.Error { w.lock.Lock(); defer w.lock.Unlock(); |