]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3161] Pass values by reference where it makes sense.
authorMarcin Siodelski <marcin@isc.org>
Tue, 13 Sep 2016 13:33:38 +0000 (15:33 +0200)
committerMarcin Siodelski <marcin@isc.org>
Tue, 13 Sep 2016 13:33:38 +0000 (15:33 +0200)
Reported by cpp-check.

src/bin/dhcp6/tests/host_unittest.cc
src/lib/asiolink/tests/udp_socket_unittest.cc
src/lib/dhcpsrv/tests/duid_config_parser_unittest.cc
src/lib/dhcpsrv/tests/pgsql_exchange_unittest.cc
src/lib/eval/tests/context_unittest.cc

index e88dc3a74971342228543fa280b3964fdc7245d6..987c49850270a51efb53c1dc9c0a91dcf692aff8 100644 (file)
@@ -453,7 +453,7 @@ public:
     /// reservation.
     void testReservationByIdentifier(Dhcp6Client& client,
                                      const unsigned int config_index,
-                                     const std::string exp_ip_address) {
+                                     const std::string& exp_ip_address) {
         configure(CONFIGS[config_index], *client.getServer());
 
         const Subnet6Collection* subnets = CfgMgr::instance().getCurrentCfg()->
index 0f3a81ba9f7fdaa6571aadc282b642b245067c7d..1a5b2a6568f3416bc7bc88301b8589c353747084 100644 (file)
@@ -79,7 +79,7 @@ public:
     /// data.
     ///
     /// \param which Which of the two callback objects this is
-    UDPCallback(std::string which) : ptr_(new PrivateData())
+    UDPCallback(const std::string& which) : ptr_(new PrivateData())
     {
         setName(which);
     }
index a4d1def328ffdb5eee8083facc2e3152da2dc425..2b6c524940742eded317d584f99e461c4d3351f4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -49,7 +49,7 @@ public:
     /// @param duid_type DUID type in numeric format.
     /// @param duid_type_text DUID type in textual format.
     void testTypeOnly(const DUID::DUIDType& duid_type,
-                      const std::string duid_type_text) const;
+                      const std::string& duid_type_text) const;
 
     /// @brief Test that invalid configuration is rejected.
     ///
@@ -109,7 +109,7 @@ DUIDConfigParserTest::build(const std::string& config) const {
 
 void
 DUIDConfigParserTest::testTypeOnly(const DUID::DUIDType& duid_type,
-                                   const std::string duid_type_text) const {
+                                   const std::string& duid_type_text) const {
     // Use DUID configuration with only a "type".
     ASSERT_NO_THROW(build(createConfigWithType(duid_type_text)));
 
index 75547a9fac01b79d400fd1186fac950251d1b669..509bf7950c6210df3b3818fc0b7e6daf3fd02316 100644 (file)
@@ -225,7 +225,7 @@ public:
     /// @lineno line number from where the call was invoked
     ///
     /// Asserts if the result set status does not equal the expected outcome.
-    void runSql(PgSqlResultPtr& r, const std::string sql, int exp_outcome,
+    void runSql(PgSqlResultPtr& r, const std::string& sql, int exp_outcome,
                 int lineno) {
         r.reset(new PgSqlResult(PQexec(*conn_, sql.c_str())));
         ASSERT_EQ(PQresultStatus(*r), exp_outcome)
index 25b02b47f7dbe9a9d3bbb65c211d60cfe708df0e..5280b2027443b1a2d70673f75542585f2b9ea0dc 100644 (file)
@@ -173,7 +173,7 @@ public:
     /// @param exp_code expected option code to be parsed
     /// @param exp_repr expected representation to be parsed
     /// @param exp_tokens expected number of tokens
-    void testRelay6Option(std::string expr,
+    void testRelay6Option(const std::string& expr,
                          uint8_t exp_level,
                          uint16_t exp_code,
                          TokenOption::RepresentationType exp_repr,
@@ -221,7 +221,7 @@ public:
     /// @param expr expression to be parsed
     /// @param exp_type expected metadata type to be parsed
     /// @param exp_tokens expected number of tokens
-    void testPktMetadata(std::string expr,
+    void testPktMetadata(const std::string& expr,
                          TokenPkt::MetadataType exp_type,
                          int exp_tokens) {
         EvalContext eval(Option::V6);
@@ -266,7 +266,7 @@ public:
     /// @param expr expression to be parsed
     /// @param exp_type expected field type to be parsed
     /// @param exp_tokens expected number of tokens
-    void testPkt4Field(std::string expr,
+    void testPkt4Field(const std::string& expr,
                        TokenPkt4::FieldType exp_type,
                        int exp_tokens) {
         EvalContext eval(Option::V4);
@@ -314,7 +314,8 @@ public:
     /// @param expr expression to be parsed
     /// @param exp_type expected field type to be parsed
     /// @param exp_tokens expected number of tokens
-    void testPkt6Field(std::string expr, TokenPkt6::FieldType exp_type,
+    void testPkt6Field(const std::string& expr,
+                       TokenPkt6::FieldType exp_type,
                        int exp_tokens) {
         EvalContext eval(Option::V6);
 
@@ -363,7 +364,7 @@ public:
     /// @param exp_level expected level to be parsed
     /// @param exp_type expected field type to be parsed
     /// @param exp_tokens expected number of tokens
-    void testRelay6Field(std::string expr,
+    void testRelay6Field(const std::string& expr,
                          uint8_t exp_level,
                          TokenRelay6Field::FieldType exp_type,
                          int exp_tokens) {
@@ -461,8 +462,9 @@ public:
     /// @param vendor_id expected vendor-id (aka enterprise number)
     /// @param option_code expected option code (ignored if 0)
     /// @param expected_repr expected representation (either 'exists' or 'hex')
-    void testVendor(std::string expr, Option::Universe u, uint32_t vendor_id,
-                    uint16_t option_code, TokenOption::RepresentationType expected_repr) {
+    void testVendor(const std::string& expr, Option::Universe u,
+                    uint32_t vendor_id, uint16_t option_code,
+                    TokenOption::RepresentationType expected_repr) {
         EvalContext eval(u);
 
         EXPECT_NO_THROW(parsed_ = eval.parseString(expr));
@@ -487,7 +489,8 @@ public:
     /// @param u universe (V4 or V6)
     /// @param vendor_id expected vendor-id (aka enterprise number)
     /// @param expected_repr expected representation (either 'exists' or 'hex')
-    void testVendor(std::string expr, Option::Universe u, uint32_t vendor_id,
+    void testVendor(const std::string& expr, Option::Universe u,
+                    uint32_t vendor_id,
                     TokenOption::RepresentationType expected_repr) {
         testVendor(expr, u, vendor_id, 0, expected_repr);
     }
@@ -499,7 +502,8 @@ public:
     ///
     /// @param expr expression to be parsed
     /// @param u universe (V4 or V6)
-    void testVendorEnterprise(std::string expr, Option::Universe u) {
+    void testVendorEnterprise(const std::string& expr,
+                              Option::Universe u) {
         EvalContext eval(u);
 
         EXPECT_NO_THROW(parsed_ = eval.parseString(expr));
@@ -524,7 +528,8 @@ public:
     /// @param expr expression to be parsed
     /// @param u universe (V4 or V6)
     /// @param vendor_id expected vendor-id (aka enterprise number)
-    void testVendorClass(std::string expr, Option::Universe u, uint32_t vendor_id) {
+    void testVendorClass(const std::string& expr,
+                         Option::Universe u, uint32_t vendor_id) {
         EvalContext eval(u);
 
         EXPECT_NO_THROW(parsed_ = eval.parseString(expr));
@@ -548,8 +553,8 @@ public:
     /// @param u universe (V4 or V6)
     /// @param vendor_id expected vendor-id (aka enterprise number)
     /// @param index expected data index
-    void testVendorClass(std::string expr, Option::Universe u, uint32_t vendor_id,
-                         uint16_t index) {
+    void testVendorClass(const std::string& expr, Option::Universe u,
+                         uint32_t vendor_id, uint16_t index) {
         EvalContext eval(u);
 
         EXPECT_NO_THROW(parsed_ = eval.parseString(expr));
@@ -572,7 +577,8 @@ public:
     ///
     /// @param expr expression to be parsed
     /// @param u universe (V4 or V6)
-    void testVendorClassEnterprise(std::string expr, Option::Universe u) {
+    void testVendorClassEnterprise(const std::string& expr,
+                                   Option::Universe u) {
         EvalContext eval(u);
 
         EXPECT_NO_THROW(parsed_ = eval.parseString(expr));