From: Teng Qin Date: Tue, 31 Oct 2017 20:49:14 +0000 (-0700) Subject: Improve folly::RequestContext::get() X-Git-Tag: v2017.11.06.00~26 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3efddaffc51304e7e6ce477189f6cc38483641c0;p=folly.git Improve folly::RequestContext::get() Summary: Since `folly::RequestContext::get()` returns raw pointer, it could directly use the reference returned by `getStaticContext()` I don't expect this to make much of a difference, just tiny improvements Reviewed By: yfeldblum Differential Revision: D6153353 fbshipit-source-id: 1c41d4fc259aa5cb3e69e50ed24bed1ba9caf6c3 --- diff --git a/folly/io/async/Request.cpp b/folly/io/async/Request.cpp index aff3fa6b..b1dd0f79 100644 --- a/folly/io/async/Request.cpp +++ b/folly/io/async/Request.cpp @@ -123,7 +123,7 @@ std::shared_ptr& RequestContext::getStaticContext() { } RequestContext* RequestContext::get() { - auto context = getStaticContext(); + auto& context = getStaticContext(); if (!context) { static RequestContext defaultContext; return std::addressof(defaultContext);