summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gerrand <adg@golang.org>2010-10-25 14:50:47 +1100
committerAndrew Gerrand <adg@golang.org>2010-10-25 14:50:47 +1100
commit4bb99ff3a27b4d9aa86dc16889014b8b7901aeba (patch)
tree0da89408c9ca22be6574eb82acf5fdcefc1a3e3c
parentbcde1c417b1e9262c1842a810c16da75c42a7dea (diff)
downloadgo-4bb99ff3a27b4d9aa86dc16889014b8b7901aeba.tar.gz
container/list: elide redundant tests and fix comment typo
R=dsymonds CC=golang-dev http://codereview.appspot.com/2700041
-rw-r--r--src/pkg/container/list/list.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/pkg/container/list/list.go b/src/pkg/container/list/list.go
index 47ceae170..578864dbe 100644
--- a/src/pkg/container/list/list.go
+++ b/src/pkg/container/list/list.go
@@ -11,7 +11,7 @@ type Element struct {
// The front of the list has prev = nil, and the back has next = nil.
next, prev *Element
- // Thie list to which this element belongs.
+ // The list to which this element belongs.
list *List
// The contents of this list element.
@@ -40,7 +40,7 @@ func (l *List) Init() *List {
}
// New returns an initialized list.
-func New() *List { return new(List).Init() }
+func New() *List { return new(List) }
// Front returns the first element in the list.
func (l *List) Front() *Element { return l.front }
@@ -127,9 +127,6 @@ func (l *List) insertBack(e *Element) {
// PushFront inserts the value at the front of the list and returns a new Element containing the value.
func (l *List) PushFront(value interface{}) *Element {
- if l == nil {
- l.Init()
- }
e := &Element{nil, nil, l, value}
l.insertFront(e)
return e
@@ -137,9 +134,6 @@ func (l *List) PushFront(value interface{}) *Element {
// PushBack inserts the value at the back of the list and returns a new Element containing the value.
func (l *List) PushBack(value interface{}) *Element {
- if l == nil {
- l.Init()
- }
e := &Element{nil, nil, l, value}
l.insertBack(e)
return e