From e1b5c992b4d138779d8e4cf1a84ac2817b4c5a95 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 26 May 2017 22:32:38 +0900 Subject: [PATCH] graphics: Refactoring: remove unnecessary empty slices --- internal/graphics/command.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/graphics/command.go b/internal/graphics/command.go index 46834093e..907d78d9f 100644 --- a/internal/graphics/command.go +++ b/internal/graphics/command.go @@ -37,10 +37,7 @@ type commandQueue struct { m sync.Mutex } -var theCommandQueue = &commandQueue{ - commands: []command{}, - vertices: []float32{}, -} +var theCommandQueue = &commandQueue{} func (q *commandQueue) appendVertices(vertices []float32) { if len(q.vertices) < q.verticesNum+len(vertices) { @@ -84,7 +81,7 @@ func (q *commandQueue) Enqueue(command command) { // its limit (maxQuads). func (q *commandQueue) commandGroups() [][]command { cs := q.commands - gs := [][]command{} + var gs [][]command quads := 0 for 0 < len(cs) { if len(gs) == 0 { @@ -149,7 +146,7 @@ func (q *commandQueue) Flush(context *opengl.Context) error { } lastN = n } - q.commands = []command{} + q.commands = nil q.verticesNum = 0 return nil }