Browse Source

[2768] Remove some more references

They save only little bit of work to the CPU and are suspicious to
casual reader, even when they should be safe in theory.
Michal 'vorner' Vaner 12 years ago
parent
commit
c32bfa79b2
2 changed files with 13 additions and 11 deletions
  1. 1 1
      src/lib/config/ccsession.cc
  2. 12 10
      src/lib/config/tests/ccsession_unittests.cc

+ 1 - 1
src/lib/config/ccsession.cc

@@ -869,7 +869,7 @@ ModuleCCSession::rpcCall(const std::string &command, const std::string &group,
         arg(group).arg(seq);
         arg(group).arg(seq);
     groupRecvMsg(env, answer, true, seq);
     groupRecvMsg(env, answer, true, seq);
     int rcode;
     int rcode;
-    const ConstElementPtr &result(parseAnswer(rcode, answer));
+    const ConstElementPtr result(parseAnswer(rcode, answer));
     if (rcode == isc::cc::CC_REPLY_NO_RECPT) {
     if (rcode == isc::cc::CC_REPLY_NO_RECPT) {
         isc_throw(RPCRecipientMissing, result);
         isc_throw(RPCRecipientMissing, result);
     } else if (rcode != isc::cc::CC_REPLY_SUCCESS) {
     } else if (rcode != isc::cc::CC_REPLY_SUCCESS) {

+ 12 - 10
src/lib/config/tests/ccsession_unittests.cc

@@ -62,16 +62,18 @@ protected:
         ModuleCCSession mccs(ccspecfile("spec1.spec"), session, NULL, NULL,
         ModuleCCSession mccs(ccspecfile("spec1.spec"), session, NULL, NULL,
                              false, false);
                              false, false);
         // Prepare the answer beforehand, it'll block until it gets one
         // Prepare the answer beforehand, it'll block until it gets one
-        const ConstElementPtr& reply_el(el(reply));
+        const ConstElementPtr reply_el(el(reply));
         session.getMessages()->add(reply_el);
         session.getMessages()->add(reply_el);
-        const ConstElementPtr& result(mccs.rpcCall("test", "Spec2",
-                                                   el("{\"param1\": \"Param 1\","
-                                                      "\"param2\": \"Param 2\"}")));
-        const ConstElementPtr& request(el("[\"Spec2\", \"*\", {"
-                                          "  \"command\": [\"test\", {"
-                                          "    \"param1\": \"Param 1\","
-                                          "    \"param2\": \"Param 2\""
-                                          "}]}, -1, true]"));
+        const ConstElementPtr
+            result(mccs.rpcCall("test", "Spec2",
+                                el("{\"param1\": \"Param 1\","
+                                   "\"param2\": \"Param 2\"}")));
+        const ConstElementPtr
+            request(el("[\"Spec2\", \"*\", {"
+                       "  \"command\": [\"test\", {"
+                       "    \"param1\": \"Param 1\","
+                       "    \"param2\": \"Param 2\""
+                       "}]}, -1, true]"));
         // The 0th one is from the initialization, to ConfigManager.
         // The 0th one is from the initialization, to ConfigManager.
         // our is the 1st.
         // our is the 1st.
         EXPECT_TRUE(request->equals(*session.getMsgQueue()->get(1))) <<
         EXPECT_TRUE(request->equals(*session.getMsgQueue()->get(1))) <<
@@ -88,7 +90,7 @@ protected:
 // Test we can send an RPC (command) and get an answer. The answer is success
 // Test we can send an RPC (command) and get an answer. The answer is success
 // in this case.
 // in this case.
 TEST_F(CCSessionTest, rpcCallSuccess) {
 TEST_F(CCSessionTest, rpcCallSuccess) {
-    const ConstElementPtr &result =
+    const ConstElementPtr result =
         rpcCheck("{\"result\": [0, {\"Hello\": \"a\"}]}");
         rpcCheck("{\"result\": [0, {\"Hello\": \"a\"}]}");
     EXPECT_TRUE(el("{\"Hello\": \"a\"}")->equals(*result));
     EXPECT_TRUE(el("{\"Hello\": \"a\"}")->equals(*result));
 }
 }