Commit bea10165 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron
Browse files

Use more efficient unique_ptr for CurlLoop::ActiveCurlRequest

parent eb1f4462
......@@ -91,7 +91,7 @@ namespace eigerapi
private:
struct ActiveCurlRequest;
typedef std::shared_ptr<ActiveCurlRequest> ActReq;
typedef std::unique_ptr<const ActiveCurlRequest> ActReq;
typedef std::map<CURL*,ActReq> MapRequests;
typedef std::list<CurlReq> ListRequests;
static void* _runFunc(void*);
......
......@@ -300,9 +300,9 @@ inline void CurlLoop::_check_new_requests()
{
const CurlReq& req = *i;
ActReq act_req(new ActiveCurlRequest(req,m_multi_handle));
MapRequests::value_type map_value(req->get_handle(),act_req);
MapRequests::value_type map_value(req->get_handle(),std::move(act_req));
typedef std::pair<MapRequests::iterator,bool> InsertResult;
InsertResult result = m_pending_requests.insert(map_value);
InsertResult result = m_pending_requests.insert(std::move(map_value));
if(!result.second)
THROW_EIGER_EXCEPTION("CurlLoop::_check_new_requests",
"handle found in pending requests");
......@@ -425,5 +425,3 @@ void CurlLoop::_run()
//cleanup
m_pending_requests.clear();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment