]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] use a separate object to pass to a function instead of a temporary
authorJINMEI Tatuya <jinmei@isc.org>
Wed, 3 Apr 2013 23:59:52 +0000 (23:59 +0000)
committerJINMEI Tatuya <jinmei@isc.org>
Wed, 3 Apr 2013 23:59:52 +0000 (23:59 +0000)
some compilers claim it causes a copy whie it's defined non copyable,
triggering an error.  this fixes some build failure reported by the bots.
should mostly trivial, so committing at my discretion.

src/lib/datasrc/tests/cache_config_unittest.cc

index 8b3e6af4e673f00ff1b0680aa68aa9ad8e0bfd97..8c266ec3b53d3988ed06a56078a13a2d66bd8b5f 100644 (file)
@@ -74,14 +74,15 @@ TEST_F(CacheConfigTest, constructMasterFiles) {
                           " \"example.org\": \"file2\","
                           " \"example.info\": \"file3\"}"
                           "}"));
-    EXPECT_EQ(3, countZones(CacheConfig("MasterFiles", 0, *config_elem_multi,
-                                        true)));
+    const CacheConfig cache_conf2("MasterFiles", 0, *config_elem_multi, true);
+    EXPECT_EQ(3, countZones(cache_conf2));
 
     // A bit unusual, but acceptable case: empty parameters, so no zones.
-    EXPECT_EQ(0, countZones(
-                  CacheConfig("MasterFiles", 0,
-                              *Element::fromJSON("{\"cache-enable\": true,"
-                                                 " \"params\": {}}"), true)));
+    const CacheConfig cache_conf3("MasterFiles", 0,
+                                  *Element::fromJSON("{\"cache-enable\": true,"
+                                                     " \"params\": {}}"),
+                                  true);
+    EXPECT_EQ(0, countZones(cache_conf3));
 }
 
 TEST_F(CacheConfigTest, badConstructMasterFiles) {
@@ -153,15 +154,16 @@ TEST_F(CacheConfigTest, constructWithMock) {
                           " \"cache-zones\": "
                           "[\"example.com\", \"example.org\",\"example.info\"]"
                           "}"));
-    EXPECT_EQ(3, countZones(CacheConfig("mock", &mock_client_,
-                                        *config_elem_multi, true)));
+    const CacheConfig cache_conf2("mock", &mock_client_, *config_elem_multi,
+                                  true);
+    EXPECT_EQ(3, countZones(cache_conf2));
 
     // Empty
-    EXPECT_EQ(0, countZones(
-                  CacheConfig("mock", &mock_client_,
-                              *Element::fromJSON("{\"cache-enable\": true,"
-                                                 " \"cache-zones\": []}"),
-                              true)));
+    const CacheConfig cache_conf3(
+        "mock", &mock_client_,
+        *Element::fromJSON("{\"cache-enable\": true,"
+                           " \"cache-zones\": []}"), true);
+    EXPECT_EQ(0, countZones(cache_conf3));
 
     // disabled.  value of cache-zones are ignored.
     const ConstElementPtr config_elem_disabled(