BIND 10 trac1176, updated. 3a838eb454ed0de4f073b99e94e02014eca63a56 [1176] Operator to combine FindOptions
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Sep 6 08:51:07 UTC 2011
The branch, trac1176 has been updated
via 3a838eb454ed0de4f073b99e94e02014eca63a56 (commit)
from 38c8e9a9ccfd7fd57bc5fa5090c86cf7b7920d28 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3a838eb454ed0de4f073b99e94e02014eca63a56
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Sep 6 10:36:47 2011 +0200
[1176] Operator to combine FindOptions
-----------------------------------------------------------------------
Summary of changes:
src/bin/auth/query.cc | 6 ++----
src/lib/datasrc/zone.h | 12 ++++++++++++
2 files changed, 14 insertions(+), 4 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/auth/query.cc b/src/bin/auth/query.cc
index 803123d..f095399 100644
--- a/src/bin/auth/query.cc
+++ b/src/bin/auth/query.cc
@@ -67,7 +67,7 @@ Query::findAddrs(ZoneFinder& zone, const Name& qname,
// Find A rrset
if (qname_ != qname || qtype_ != RRType::A()) {
ZoneFinder::FindResult a_result = zone.find(qname, RRType::A(), NULL,
- static_cast<ZoneFinder::FindOptions>(options | dnssec_opt_));
+ options);
if (a_result.code == ZoneFinder::SUCCESS) {
response_.addRRset(Message::SECTION_ADDITIONAL,
boost::const_pointer_cast<RRset>(a_result.rrset), dnssec_);
@@ -77,9 +77,7 @@ Query::findAddrs(ZoneFinder& zone, const Name& qname,
// Find AAAA rrset
if (qname_ != qname || qtype_ != RRType::AAAA()) {
ZoneFinder::FindResult aaaa_result =
- zone.find(qname, RRType::AAAA(), NULL,
- static_cast<ZoneFinder::FindOptions>(options |
- dnssec_opt_));
+ zone.find(qname, RRType::AAAA(), NULL, options | dnssec_opt_);
if (aaaa_result.code == ZoneFinder::SUCCESS) {
response_.addRRset(Message::SECTION_ADDITIONAL,
boost::const_pointer_cast<RRset>(aaaa_result.rrset),
diff --git a/src/lib/datasrc/zone.h b/src/lib/datasrc/zone.h
index c5e1a06..5d5f86f 100644
--- a/src/lib/datasrc/zone.h
+++ b/src/lib/datasrc/zone.h
@@ -205,6 +205,18 @@ public:
//@}
};
+/// \brief Operator to combine FindOptions
+///
+/// We would need to manually static-cast the options if we put or
+/// between them, which is undesired with bit-flag options. Therefore
+/// we hide the cast here, which is the simplest solution and it still
+/// provides reasonable level of type safety.
+inline ZoneFinder::FindOptions operator |(ZoneFinder::FindOptions a,
+ ZoneFinder::FindOptions b)
+{
+ return (static_cast<ZoneFinder::FindOptions>(a | b));
+}
+
/// \brief A pointer-like type pointing to a \c ZoneFinder object.
typedef boost::shared_ptr<ZoneFinder> ZoneFinderPtr;
More information about the bind10-changes
mailing list