From 26a6d3f833b19cfece256e03eccda24fb87c0601 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Sun, 20 May 2012 20:46:25 +0200 Subject: [PATCH] small tweaks --- README.markdown | 3 +-- zgenerate.go | 12 +++++------- zscan.go | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/README.markdown b/README.markdown index b5234ed3..b769f6c5 100644 --- a/README.markdown +++ b/README.markdown @@ -22,7 +22,6 @@ can build servers and resolvers with it. * Fast: * Reply speed around 35/40K qps (faster hardware results in more qps); * Parsing RRs (zone files) with 95/100K RR/s, that's 5M records in about 50 seconds; - * This is expected to be optimized further. * Client and server side programming (mimicking the net/http package); * Asynchronous queries/replies for client and server; * DNSSEC: signing, validating and key generation for DSA, RSA and ECDSA; @@ -33,7 +32,7 @@ can build servers and resolvers with it. Have fun! -Miek Gieben - 2010-2012 - miek@miek.nl +Miek Gieben - 2010-2012 - miek@miek.nl # Building diff --git a/zgenerate.go b/zgenerate.go index 1c5ae293..b6e851a6 100644 --- a/zgenerate.go +++ b/zgenerate.go @@ -102,14 +102,12 @@ BuildRR: if sep == -1 { return "bad modifier in $GENERATE" } - //println("checking", s[j+2:j+2+sep]) mod, offset, err = modToPrintf(s[j+2 : j+2+sep]) if err != "" { return err } j += 2 + sep // Jump to it } - //println("mod", mod) dom += fmt.Sprintf(mod, i+offset) default: if escape { // Pretty useless here @@ -125,6 +123,8 @@ BuildRR: return e.(*ParseError).err } t <- Token{RR: rx} + // Its more efficient to first built the rrlist and then parse it in + // one go! But is this a problem? } return "" } @@ -147,15 +147,13 @@ func modToPrintf(s string) (string, int, string) { if err != nil { return "", offset, "bad width in $GENERATE" } - printf := "%" switch { case width < 0: return "", offset, "bad width in $GENERATE" case width == 0: - printf += xs[1] + return "%" + xs[1] + xs[2], offset, "" default: - printf += "0" + xs[1] + return "%0" + xs[1] + xs[2], offset, "" } - printf += xs[2] - return printf, offset, "" + panic("not reached") } diff --git a/zscan.go b/zscan.go index f2377916..f1b92393 100644 --- a/zscan.go +++ b/zscan.go @@ -123,7 +123,7 @@ func ReadRR(q io.Reader, filename string) (RR, error) { // Basic usage pattern when reading from a string (z) containing the // zone data: // -// for x := range dns.ParseZone(strings.NewReader(z), "", "testzone") { +// for x := range dns.ParseZone(strings.NewReader(z), "", "") { // if x.Error != nil { // // Do something with x.RR // }