Browse Source

[1914] Cleanup: remove shared_ptr

It seems a list can be declared for a class that is not fully defined
yet. So there's no need for pointers, so even less for shared ones.
Michal 'vorner' Vaner 13 years ago
parent
commit
d06b9b84af
2 changed files with 8 additions and 8 deletions
  1. 7 7
      src/lib/config/ccsession.cc
  2. 1 1
      src/lib/config/ccsession.h

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

@@ -782,11 +782,11 @@ ModuleCCSession::groupRecvMsgAsync(const AsyncRecvCallback& callback,
                                    bool is_reply, int seq,
                                    const string& recipient) {
     // This just stores the request, the handling is done in checkCommand()
-    boost::shared_ptr<AsyncRecvRequest> request(new AsyncRecvRequest);
-    request->callback = callback;
-    request->recipient = recipient;
-    request->seq = seq;
-    request->is_reply = is_reply;
+    AsyncRecvRequest request;
+    request.callback = callback;
+    request.recipient = recipient;
+    request.seq = seq;
+    request.is_reply = is_reply;
     // push_back would be simpler, but it does not return the iterator we need
     return (async_recv_requests_.insert(async_recv_requests_.end(), request));
 }
@@ -798,7 +798,7 @@ ModuleCCSession::checkAsyncRecv(const ConstElementPtr& envelope,
     for (AsyncRecvRequestID request(async_recv_requests_.begin());
          request != async_recv_requests_.end(); ++ request) {
         // Just go through all the requests and look for a matching one
-        if (requestMatch(**request, envelope)) {
+        if (requestMatch(*request, envelope)) {
             // We want the request to be still alive at the time we
             // call the callback. But we need to remove it on an exception
             // too, so we use the class. If just C++ had the finally keyword.
@@ -817,7 +817,7 @@ ModuleCCSession::checkAsyncRecv(const ConstElementPtr& envelope,
                 AsyncRecvRequestID request_;
             } deleter(async_recv_requests_, request);
             // Call the callback
-            (*request)->callback(envelope, msg, request);
+            request->callback(envelope, msg, request);
         }
     }
     return (false);

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

@@ -369,7 +369,7 @@ public:
     class AsyncRecvRequest;
 
     /// \brief List of all requests for asynchronous reads.
-    typedef std::list<boost::shared_ptr<AsyncRecvRequest> > AsyncRecvRequests;
+    typedef std::list<AsyncRecvRequest> AsyncRecvRequests;
 
     /// \brief Identifier of single request for asynchronous read.
     typedef AsyncRecvRequests::iterator AsyncRecvRequestID;