From c15348f9397b97e69745540677aabee70673d674 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 22 Jul 2018 05:29:02 +0900 Subject: [PATCH] packing: Improve panic messages --- internal/packing/packing.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/packing/packing.go b/internal/packing/packing.go index 52859bc4a..d2488ce08 100644 --- a/internal/packing/packing.go +++ b/internal/packing/packing.go @@ -147,7 +147,7 @@ func (p *Page) Size() int { func (p *Page) Alloc(width, height int) *Node { if width <= 0 || height <= 0 { - panic("bsp: width and height must > 0") + panic("packing: width and height must > 0") } if p.root == nil { p.root = &Node{ @@ -167,14 +167,14 @@ func (p *Page) Alloc(width, height int) *Node { func (p *Page) Free(node *Node) { if node.child0 != nil || node.child1 != nil { - panic("bsp: can't free the node including children") + panic("packing: can't free the node including children") } node.used = false if node.parent == nil { return } if node.parent.child0 == nil || node.parent.child1 == nil { - panic("not reached") + panic("not reached: double free?") } if node.parent.child0.canFree() && node.parent.child1.canFree() { node.parent.child0 = nil