Browse Source

[1891] (unrelated) cleanup: unify the definition of faked NSEC3 strings.

defining const values in a shared header file isn't illegal, but it
could cause definition bloat (it's up to the linker implementation
whether to combine them).  in practice this probably doesn't matter
much for this limited scope purpose, but it's still cleaner to avoid
the bloat.
JINMEI Tatuya 13 years ago
parent
commit
358beb2e1e
2 changed files with 26 additions and 11 deletions
  1. 13 0
      src/lib/datasrc/tests/faked_nsec3.cc
  2. 13 11
      src/lib/datasrc/tests/faked_nsec3.h

+ 13 - 0
src/lib/datasrc/tests/faked_nsec3.cc

@@ -28,6 +28,19 @@ namespace isc {
 namespace datasrc {
 namespace test {
 
+// Constant data definitions
+
+const char* const nsec3_common = " 300 IN NSEC3 1 1 12 aabbccdd "
+    "2T7B4G4VSA5SMI47K61MV5BV1A22BOJR A RRSIG";
+const char* const nsec3_rrsig_common = " 300 IN RRSIG NSEC3 5 3 3600 "
+    "20000101000000 20000201000000 12345 example.org. FAKEFAKEFAKE";
+const char* const apex_hash = "0P9MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
+const char* const apex_hash_lower = "0p9mhaveqvm6t7vbl5lop2u3t2rp3tom";
+const char* const ns1_hash = "2T7B4G4VSA5SMI47K61MV5BV1A22BOJR";
+const char* const w_hash = "01UDEMVP1J2F7EG6JEBPS17VP3N8I58H";
+const char* const xyw_hash = "2vptu5timamqttgl4luu9kg21e0aor3s";
+const char* const zzz_hash = "R53BQ7CC2UVMUBFU5OCMM6PERS9TK9EN";
+
 class TestNSEC3HashCreator::TestNSEC3Hash : public NSEC3Hash {
 private:
     typedef map<Name, string> NSEC3HashMap;

+ 13 - 11
src/lib/datasrc/tests/faked_nsec3.h

@@ -31,26 +31,24 @@ namespace test {
 //
 // Commonly used NSEC3 suffix.  It's incorrect to use it for all NSEC3s, but
 // doesn't matter for the purpose of our tests.
-const char* const nsec3_common = " 300 IN NSEC3 1 1 12 aabbccdd "
-    "2T7B4G4VSA5SMI47K61MV5BV1A22BOJR A RRSIG";
+extern const char* const nsec3_common;
 // Likewise, common RRSIG suffix for NSEC3s.
-const char* const nsec3_rrsig_common = " 300 IN RRSIG NSEC3 5 3 3600 "
-    "20000101000000 20000201000000 12345 example.org. FAKEFAKEFAKE";
+extern const char* const nsec3_rrsig_common;
 
 // Some faked NSEC3 hash values commonly used in tests and the faked NSEC3Hash
 // object.
 //
 // For apex (example.org)
-const char* const apex_hash = "0P9MHAVEQVM6T7VBL5LOP2U3T2RP3TOM";
-const char* const apex_hash_lower = "0p9mhaveqvm6t7vbl5lop2u3t2rp3tom";
+extern const char* const apex_hash;
+extern const char* const apex_hash_lower;
 // For ns1.example.org
-const char* const ns1_hash = "2T7B4G4VSA5SMI47K61MV5BV1A22BOJR";
+extern const char* const ns1_hash;
 // For w.example.org
-const char* const w_hash = "01UDEMVP1J2F7EG6JEBPS17VP3N8I58H";
+extern const char* const w_hash;
 // For x.y.w.example.org (lower-cased)
-const char* const xyw_hash = "2vptu5timamqttgl4luu9kg21e0aor3s";
+extern const char* const xyw_hash;
 // For zzz.example.org.
-const char* const zzz_hash = "R53BQ7CC2UVMUBFU5OCMM6PERS9TK9EN";
+extern const char* const zzz_hash;
 
 // A simple faked NSEC3 hash calculator with a dedicated creator for it.
 //
@@ -83,4 +81,8 @@ performNSEC3Test(ZoneFinder &finder);
 }
 }
 
-#endif
+#endif  // FAKED_NSEC3_H
+
+// Local Variables:
+// mode: c++
+// End: