From: Nick Terrell Date: Fri, 24 Mar 2017 22:00:07 +0000 (-0700) Subject: Avoid passing temporary to get_ref_default() X-Git-Tag: v2017.03.27.00~3 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=c16a3f3775fa166503b4a07150a709c6787c1471 Avoid passing temporary to get_ref_default() Summary: `get_ref_default()` won't accept temporary default values after D4768769. Reviewed By: yfeldblum Differential Revision: D4769043 fbshipit-source-id: 46b039e13b80721922f69036c6cc02f5642a26f9 --- diff --git a/folly/io/async/Request.cpp b/folly/io/async/Request.cpp index 0c56d200..e82b16fd 100644 --- a/folly/io/async/Request.cpp +++ b/folly/io/async/Request.cpp @@ -61,12 +61,14 @@ bool RequestContext::hasContextData(const std::string& val) const { } RequestData* RequestContext::getContextData(const std::string& val) { - return get_ref_default(*data_.rlock(), val, nullptr).get(); + const std::unique_ptr dflt{nullptr}; + return get_ref_default(*data_.rlock(), val, dflt).get(); } const RequestData* RequestContext::getContextData( const std::string& val) const { - return get_ref_default(*data_.rlock(), val, nullptr).get(); + const std::unique_ptr dflt{nullptr}; + return get_ref_default(*data_.rlock(), val, dflt).get(); } void RequestContext::onSet() {