Browse Source

[1975] editorial fixes: constify, brace position, newlines, typo.

I added newlines before the start of doxygen doc.  We don't have it our
guideline, but I thought we agreed before we add to insert a new line here
for readability.
JINMEI Tatuya 13 years ago
parent
commit
115179c904
2 changed files with 19 additions and 7 deletions
  1. 5 5
      src/lib/datasrc/container.cc
  2. 14 2
      src/lib/datasrc/container.h

+ 5 - 5
src/lib/datasrc/container.cc

@@ -58,8 +58,7 @@ ConfigurableContainer::configure(const ConstElementPtr& config, bool) {
         // ready. So just put it there and let the old one die when we exit
         // the scope.
         data_sources_.swap(new_data_sources);
-    }
-    catch (const TypeError& te) {
+    } catch (const TypeError& te) {
         isc_throw(ConfigurationError, "Malformed configuration at data source "
                   "no. " << i << ": " << te.what());
     }
@@ -67,7 +66,7 @@ ConfigurableContainer::configure(const ConstElementPtr& config, bool) {
 
 Container::SearchResult
 ConfigurableContainer::search(const dns::Name& name, bool want_exact_match,
-                              bool ) const
+                              bool) const
 {
     // Nothing found yet.
     // Pointer is used as the SearchResult can't be assigned.
@@ -80,7 +79,8 @@ ConfigurableContainer::search(const dns::Name& name, bool want_exact_match,
         // zones and zones expected to be in the real data source. If it is
         // the cached one, provide the cached one. If it is in the external
         // data source, use the datasource and don't provide the finder yet.
-        DataSourceClient::FindResult result(info.data_src_->findZone(name));
+        const DataSourceClient::FindResult result(
+            info.data_src_->findZone(name));
         switch (result.code) {
             case result::SUCCESS: {
                 // If we found an exact match, we have no hope to getting
@@ -95,7 +95,7 @@ ConfigurableContainer::search(const dns::Name& name, bool want_exact_match,
                 if (!want_exact_match) {
                     // In case we have a partial match, check if it is better
                     // than what we have. If so, replace it.
-                    uint8_t labels(
+                    const uint8_t labels(
                         result.zone_finder->getOrigin().getLabelCount());
                     if (labels > candidate->matched_labels_) {
                         // This one is strictly better. Replace it.

+ 14 - 2
src/lib/datasrc/container.h

@@ -46,7 +46,7 @@ typedef boost::shared_ptr<DataSourceClientContainer>
 /// is the ConfigurableContainer.
 class Container : public boost::noncopyable {
 protected:
-    /// \brief Constructur.
+    /// \brief Constructor.
     ///
     /// It is protected to prevent accidental creation of the abstract base
     /// class.
@@ -70,6 +70,7 @@ public:
             matched_labels_(matched_labels),
             exact_match_(exact_match)
         { }
+
         /// \brief Negative answer constructor.
         ///
         /// This conscructs a result for negative answer. Both pointers are
@@ -79,6 +80,7 @@ public:
             matched_labels_(0),
             exact_match_(false)
         { }
+
         /// \brief Comparison operator.
         ///
         /// It is needed for tests and it might be of some use elsewhere
@@ -89,11 +91,13 @@ public:
                     matched_labels_ == other.matched_labels_ &&
                     exact_match_ == other.exact_match_);
         }
+
         /// \brief The found data source.
         ///
         /// The data source containing the best matching zone. If no such
         /// data source exists, this is NULL pointer.
         DataSourceClient* const datasrc_;
+
         /// \brief The finder for the requested zone.
         ///
         /// This is the finder corresponding to the best matching zone.
@@ -102,15 +106,18 @@ public:
         ///
         /// \see search
         const ZoneFinderPtr finder_;
+
         /// \brief Number of matching labels.
         ///
         /// The number of labels the result have in common with the queried
         /// name of zone.
         const uint8_t matched_labels_;
+
         /// \brief If the result is an exact match.
         const bool exact_match_;
     };
-    /// \brief Search for a zone thourgh the data sources.
+
+    /// \brief Search for a zone through the data sources.
     ///
     /// This searches the contained data sources for a one that best matches
     /// the zone name.
@@ -181,6 +188,7 @@ public:
             Exception(file, line, what)
         { }
     };
+
     /// \brief Sets the configuration.
     ///
     /// This fills the Container with data sources corresponding to the
@@ -201,6 +209,7 @@ public:
     ///     sense.
     void configure(const data::ConstElementPtr& configuration,
                    bool allow_cache);
+
     /// \brief Implementation of the Container::search.
     virtual SearchResult search(const dns::Name& zone,
                                 bool want_exact_match = false,
@@ -213,6 +222,7 @@ public:
         DataSourceClient* data_src_;
         DataSourceClientContainerPtr container_;
     };
+
     /// \brief The collection of data sources.
     typedef std::vector<DataSourceInfo> DataSources;
 protected:
@@ -221,11 +231,13 @@ protected:
     /// All our data sources are stored here. It is protected to let the
     /// tests in.
     DataSources data_sources_;
+
     /// \brief Convenience type alias.
     ///
     /// \see getDataSource
     typedef std::pair<DataSourceClient*, DataSourceClientContainerPtr>
         DataSourcePair;
+
     /// \brief Create a data source of given type and configuration.
     ///
     /// This is a thin wrapper around the DataSourceClientContainer