From 0b7dfaabe00175e056429576a1d16f64b86b7e0d Mon Sep 17 00:00:00 2001 From: XMRig Date: Mon, 1 Mar 2021 19:04:03 +0700 Subject: [PATCH] Code cleanup. --- src/base/net/http/HttpContext.cpp | 10 ++++------ src/base/net/http/HttpContext.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/base/net/http/HttpContext.cpp b/src/base/net/http/HttpContext.cpp index 52739e4d5..d56db0c8e 100644 --- a/src/base/net/http/HttpContext.cpp +++ b/src/base/net/http/HttpContext.cpp @@ -1,7 +1,7 @@ /* XMRig * Copyright (c) 2014-2019 heapwolf - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -175,11 +175,9 @@ void xmrig::HttpContext::close(int status) xmrig::HttpContext *xmrig::HttpContext::get(uint64_t id) { - if (storage.count(id) == 0) { - return nullptr; - } + const auto it = storage.find(id); - return storage[id]; + return it == storage.end() ? nullptr : it->second; } diff --git a/src/base/net/http/HttpContext.h b/src/base/net/http/HttpContext.h index 4202bfaf5..9c719333c 100644 --- a/src/base/net/http/HttpContext.h +++ b/src/base/net/http/HttpContext.h @@ -1,7 +1,7 @@ /* XMRig * Copyright (c) 2014-2019 heapwolf - * Copyright (c) 2018-2020 SChernykh - * Copyright (c) 2016-2020 XMRig , + * Copyright (c) 2018-2021 SChernykh + * Copyright (c) 2016-2021 XMRig , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by