From 97b6ca3e76c04aa52c4f7560d7db263363ca23ee Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 16 Dec 2011 19:38:44 +0100 Subject: [PATCH] Remove qname string --- Makefile | 1 - qnamestring.go | 60 -------------------------------------------------- 2 files changed, 61 deletions(-) delete mode 100644 qnamestring.go diff --git a/Makefile b/Makefile index 9c9d6e8a..ea8aedc1 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,6 @@ GOFILES=\ kscan.go\ msg.go\ nsec3.go \ - qnamestring.go\ rawmsg.go \ server.go \ tsig.go\ diff --git a/qnamestring.go b/qnamestring.go deleted file mode 100644 index 431d7afe..00000000 --- a/qnamestring.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2011 Miek Gieben. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package dns - -const initialSize = 8 - -type QnameString []string - -func NewQnameString() *QnameString { - p := make(QnameString, 0) - return &p -} - -func (p *QnameString) Insert(i int, x string) { - p.Expand(i, 1) - (*p)[i] = x - -} -func (p *QnameString) Expand(i, n int) { - a := *p - - // make sure we have enough space - len0 := len(a) - len1 := len0 + n - if len1 <= cap(a) { - // enough space - just expand - a = a[0:len1] - } else { - // not enough space - double capacity - capb := cap(a) * 2 - if capb < len1 { - // still not enough - use required length - capb = len1 - } - // capb >= len1 - a = p.realloc(len1, capb) - } - - // make a hole - for j := len0 - 1; j >= i; j-- { - a[j+n] = a[j] - } - - *p = a -} - -func (p *QnameString) realloc(length, capacity int) (b []string) { - if capacity < initialSize { - capacity = initialSize - } - if capacity < length { - capacity = length - } - b = make(QnameString, length, capacity) - copy(b, *p) - *p = b - return -}