Removed unesseccary copies

This commit is contained in:
MHaselmaier 2021-05-03 12:10:21 +02:00
parent 19e9c59b62
commit ffcc180dc1
3 changed files with 8 additions and 7 deletions

View File

@ -94,7 +94,7 @@ Executor::Executor(v_int32 processorWorkersCount, v_int32 ioWorkersCount, v_int3
m_allWorkers.insert(m_allWorkers.end(), m_processorWorkers.begin(), m_processorWorkers.end());
std::vector<std::shared_ptr<worker::Worker>> ioWorkers;
ioWorkers.reserve(ioWorkersCount);
switch(ioWorkerType) {
case IO_WORKER_TYPE_NAIVE: {
@ -119,6 +119,7 @@ Executor::Executor(v_int32 processorWorkersCount, v_int32 ioWorkersCount, v_int3
linkWorkers(ioWorkers);
std::vector<std::shared_ptr<worker::Worker>> timerWorkers;
timerWorkers.reserve(timerWorkersCount);
for(v_int32 i = 0; i < timerWorkersCount; i++) {
timerWorkers.push_back(std::make_shared<worker::TimerWorker>());
}
@ -233,10 +234,10 @@ void Executor::stop() {
}
v_int32 Executor::getTasksCount() {
v_int32 result = 0;
for(auto procWorker : m_processorWorkers) {
for(const auto& procWorker : m_processorWorkers) {
result += procWorker->getProcessor().getTasksCount();
}

View File

@ -33,7 +33,7 @@ namespace oatpp { namespace web { namespace mime { namespace multipart {
Part::Part(const Headers &headers,
const std::shared_ptr<data::stream::InputStream> &inputStream,
const oatpp::String inMemoryData,
const oatpp::String& inMemoryData,
v_int64 knownSize)
: m_headers(headers)
, m_inputStream(inputStream)
@ -60,7 +60,7 @@ Part::Part(const Headers& headers) : Part(headers, nullptr, nullptr, -1) {}
Part::Part() : Part(Headers(), nullptr, nullptr, -1) {}
void Part::setDataInfo(const std::shared_ptr<data::stream::InputStream>& inputStream,
const oatpp::String inMemoryData,
const oatpp::String& inMemoryData,
v_int64 knownSize)
{
m_inputStream = inputStream;

View File

@ -61,7 +61,7 @@ public:
*/
Part(const Headers& headers,
const std::shared_ptr<data::stream::InputStream>& inputStream,
const oatpp::String inMemoryData,
const oatpp::String& inMemoryData,
v_int64 knownSize);
/**
@ -82,7 +82,7 @@ public:
* @param knownSize - known size of the data in the input stream. Pass `-1` value if size is unknown.
*/
void setDataInfo(const std::shared_ptr<data::stream::InputStream>& inputStream,
const oatpp::String inMemoryData,
const oatpp::String& inMemoryData,
v_int64 knownSize);
/**