Commit 3efddaff authored by Teng Qin's avatar Teng Qin Committed by Facebook Github Bot

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
parent ecd0fb38
...@@ -123,7 +123,7 @@ std::shared_ptr<RequestContext>& RequestContext::getStaticContext() { ...@@ -123,7 +123,7 @@ std::shared_ptr<RequestContext>& RequestContext::getStaticContext() {
} }
RequestContext* RequestContext::get() { RequestContext* RequestContext::get() {
auto context = getStaticContext(); auto& context = getStaticContext();
if (!context) { if (!context) {
static RequestContext defaultContext; static RequestContext defaultContext;
return std::addressof(defaultContext); return std::addressof(defaultContext);
......
Markdown is supported
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