Parcourir la source

[2377] Keep a boolean variable for option

The option would be used often. While the produced code would probably
be the same, because the compiler can see it's equivalent, this is more
convenient to use.
Michal 'vorner' Vaner il y a 12 ans
Parent
commit
2f50510237
1 fichiers modifiés avec 5 ajouts et 3 suppressions
  1. 5 3
      src/lib/dns/master_loader.cc

+ 5 - 3
src/lib/dns/master_loader.cc

@@ -44,6 +44,7 @@ public:
         master_file_(master_file),
         master_file_(master_file),
         initialized_(false),
         initialized_(false),
         ok_(true),
         ok_(true),
+        many_errors_((options & MANY_ERRORS) != 0),
         complete_(false)
         complete_(false)
     {}
     {}
 
 
@@ -51,7 +52,7 @@ public:
                      const std::string& reason)
                      const std::string& reason)
     {
     {
         callbacks_.error(filename, line, reason);
         callbacks_.error(filename, line, reason);
-        if (!(options_ & MANY_ERRORS)) {
+        if (!many_errors_) {
             // In case we don't have the lenient mode, every error is fatal
             // In case we don't have the lenient mode, every error is fatal
             // and we throw
             // and we throw
             ok_ = false;
             ok_ = false;
@@ -97,9 +98,10 @@ private:
     AddRRCallback add_callback_;
     AddRRCallback add_callback_;
     MasterLoader::Options options_;
     MasterLoader::Options options_;
     const std::string master_file_;
     const std::string master_file_;
+    std::string string_token_;
     bool initialized_;
     bool initialized_;
     bool ok_;
     bool ok_;
-    std::string string_token_;
+    const bool many_errors_;
 public:
 public:
     bool complete_;
     bool complete_;
 };
 };
@@ -165,7 +167,7 @@ MasterLoader::MasterLoaderImpl::loadIncremental(size_t count_limit) {
 
 
                 // Good, we loaded another one
                 // Good, we loaded another one
                 ++count;
                 ++count;
-            } else if ((options_ & MANY_ERRORS) == 0) {
+            } else if (!many_errors_) {
                 ok_ = false;
                 ok_ = false;
                 complete_ = true;
                 complete_ = true;
                 // We don't have the exact error here, but it was reported
                 // We don't have the exact error here, but it was reported