Browse Source

[2387] Move string construction out of loop

Mukund Sivaraman 12 years ago
parent
commit
ea89361128

+ 1 - 1
src/lib/dns/rdata/generic/detail/nsec_bitmap.cc

@@ -86,6 +86,7 @@ buildBitmapsFromLexer(const char* const rrtype_name,
     memset(bitmap, 0, sizeof(bitmap));
 
     bool have_rrtypes = false;
+    std::string type_str;
     while (true) {
         const MasterToken& token =
             lexer.getNextToken(MasterToken::STRING, true);
@@ -97,7 +98,6 @@ buildBitmapsFromLexer(const char* const rrtype_name,
         // token is now assured to be of type STRING.
 
         have_rrtypes = true;
-        std::string type_str;
         token.getString(type_str);
         try {
             const int code = RRType(type_str).getCode();

+ 1 - 1
src/lib/dns/rdata/generic/dnskey_48.cc

@@ -161,6 +161,7 @@ DNSKEY::constructFromLexer(MasterLexer& lexer) {
     }
 
     std::string keydata_str;
+    std::string keydata_substr;
     while (true) {
         const MasterToken& token =
             lexer.getNextToken(MasterToken::STRING, true);
@@ -171,7 +172,6 @@ DNSKEY::constructFromLexer(MasterLexer& lexer) {
 
         // token is now assured to be of type STRING.
 
-        std::string keydata_substr;
         token.getString(keydata_substr);
         keydata_str.append(keydata_substr);
     }