[bind10-dev] BIND 10 trac503, updated. implement ANY query logic

Michal 'vorner' Vaner michal.vaner at nic.cz
Wed Jan 26 08:36:46 UTC 2011


Hello

On Wed, Jan 26, 2011 at 06:49:18AM +0000, BIND 10 source code commits wrote:
> +    const bool qtype_is_any = (qtype_ == RRType::ANY());
> +    RRsetList result_rrsets;
> +    RRsetList* target = NULL;
> +
>      response_.setHeaderFlag(Message::HEADERFLAG_AA, false);
>      const MemoryDataSrc::FindResult result =
>          memory_datasrc_.findZone(qname_);
> @@ -141,20 +145,33 @@ Query::process() const {
>      response_.setHeaderFlag(Message::HEADERFLAG_AA);
>      while (keep_doing) {
>          keep_doing = false;
> -        Zone::FindResult db_result = result.zone->find(qname_, qtype_);
> +        if (qtype_is_any) {
> +            target = &result_rrsets;
> +        }

This just got my attention. Not that it would be a problem, just a small
suggestion. This way the RRsetList is created each time. It probably isn't much,
but ANY queries are rare.

I would suggest using an
std::auto_ptr<RRsetList> target(qtype_is_any ? new RRSetList : NULL)

This way the RRsetList is created only when needed, the code complexity doesn't
grow and the auto_ptr is simple enough to be eliminated completely in
optimisations.

What do you think?

Have a nice day

-- 
How many Lisp programmers does it take to change a light bulb?
(((H)mmm,) (I'm ((not) sure, better))) (find (out))...

Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20110126/4380a8ed/attachment.bin>


More information about the bind10-dev mailing list