diff options
author | Robert Griesemer <gri@golang.org> | 2009-11-24 13:43:18 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2009-11-24 13:43:18 -0800 |
commit | 974bc55c8721b53b0c2c07baad59b86c08d07104 (patch) | |
tree | 2ae85bbcdecedd2a311365a9586e24a4e7cab1ba /src/pkg/go/scanner/errors.go | |
parent | 3dd6b9b693f7580651de03546db8fd1805aa0cdf (diff) | |
download | golang-974bc55c8721b53b0c2c07baad59b86c08d07104.tar.gz |
Change to container/vector interface:
- removed New(len int) in favor of new(Vector).Resize(len, cap)
- removed Init(len int) in favor of Resize(len, cap)
- runs all.bash
Fixes issue 294.
R=rsc, r, r1
http://codereview.appspot.com/157143
Diffstat (limited to 'src/pkg/go/scanner/errors.go')
-rw-r--r-- | src/pkg/go/scanner/errors.go | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/pkg/go/scanner/errors.go b/src/pkg/go/scanner/errors.go index 16ad53260..12c1c852f 100644 --- a/src/pkg/go/scanner/errors.go +++ b/src/pkg/go/scanner/errors.go @@ -24,9 +24,9 @@ type ErrorHandler interface { } -// ErrorVector implements the ErrorHandler interface. It must be -// initialized with Init(). It maintains a list of errors which can -// be retrieved with GetErrorList and GetError. +// ErrorVector implements the ErrorHandler interface. It maintains a list +// of errors which can be retrieved with GetErrorList and GetError. The +// zero value for an ErrorVector is an empty ErrorVector ready to use. // // A common usage pattern is to embed an ErrorVector alongside a // scanner in a data structure that uses the scanner. By passing a @@ -38,16 +38,8 @@ type ErrorVector struct { } -// Init initializes an ErrorVector. -func (h *ErrorVector) Init() { h.errors.Init(0) } - - -// NewErrorVector creates a new ErrorVector. -func NewErrorVector() *ErrorVector { - h := new(ErrorVector); - h.Init(); - return h; -} +// Reset resets an ErrorVector to no errors. +func (h *ErrorVector) Reset() { h.errors.Resize(0, 0) } // ErrorCount returns the number of errors collected. |