Skip to content

Commit e388d0c

Browse files
committed
impr: Remove unnecessary moves in the task manager
1 parent 05f8d93 commit e388d0c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/libimhex/source/api/task_manager.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ namespace hex {
6565

6666

6767
Task::Task(const UnlocalizedString &unlocalizedName, u64 maxValue, bool background, bool blocking, std::function<void(Task &)> function)
68-
: m_unlocalizedName(std::move(unlocalizedName)),
68+
: m_unlocalizedName(unlocalizedName),
6969
m_maxValue(maxValue),
7070
m_function(std::move(function)),
7171
m_background(background), m_blocking(blocking) { }
@@ -344,7 +344,7 @@ namespace hex {
344344
std::scoped_lock lock(s_queueMutex);
345345

346346
// Construct new task
347-
auto task = std::make_shared<Task>(std::move(unlocalizedName), maxValue, background, blocking, std::move(function));
347+
auto task = std::make_shared<Task>(unlocalizedName, maxValue, background, blocking, std::move(function));
348348

349349
s_tasks.emplace_back(task);
350350

@@ -359,12 +359,12 @@ namespace hex {
359359

360360
TaskHolder TaskManager::createTask(const UnlocalizedString &unlocalizedName, u64 maxValue, std::function<void(Task &)> function) {
361361
log::debug("Creating task {}", unlocalizedName.get());
362-
return createTask(std::move(unlocalizedName), maxValue, false, false, std::move(function));
362+
return createTask(unlocalizedName, maxValue, false, false, std::move(function));
363363
}
364364

365365
TaskHolder TaskManager::createTask(const UnlocalizedString &unlocalizedName, u64 maxValue, std::function<void()> function) {
366366
log::debug("Creating task {}", unlocalizedName.get());
367-
return createTask(std::move(unlocalizedName), maxValue, false, false,
367+
return createTask(unlocalizedName, maxValue, false, false,
368368
[function = std::move(function)](Task&) {
369369
function();
370370
}
@@ -373,12 +373,12 @@ namespace hex {
373373

374374
TaskHolder TaskManager::createBackgroundTask(const UnlocalizedString &unlocalizedName, std::function<void(Task &)> function) {
375375
log::debug("Creating background task {}", unlocalizedName.get());
376-
return createTask(std::move(unlocalizedName), 0, true, false, std::move(function));
376+
return createTask(unlocalizedName, 0, true, false, std::move(function));
377377
}
378378

379379
TaskHolder TaskManager::createBackgroundTask(const UnlocalizedString &unlocalizedName, std::function<void()> function) {
380380
log::debug("Creating background task {}", unlocalizedName.get());
381-
return createTask(std::move(unlocalizedName), 0, true, false,
381+
return createTask(unlocalizedName, 0, true, false,
382382
[function = std::move(function)](Task&) {
383383
function();
384384
}
@@ -387,12 +387,12 @@ namespace hex {
387387

388388
TaskHolder TaskManager::createBlockingTask(const UnlocalizedString &unlocalizedName, u64 maxValue, std::function<void(Task &)> function) {
389389
log::debug("Creating blocking task {}", unlocalizedName.get());
390-
return createTask(std::move(unlocalizedName), maxValue, true, true, std::move(function));
390+
return createTask(unlocalizedName, maxValue, true, true, std::move(function));
391391
}
392392

393393
TaskHolder TaskManager::createBlockingTask(const UnlocalizedString &unlocalizedName, u64 maxValue, std::function<void()> function) {
394394
log::debug("Creating blocking task {}", unlocalizedName.get());
395-
return createTask(std::move(unlocalizedName), maxValue, true, true,
395+
return createTask(unlocalizedName, maxValue, true, true,
396396
[function = std::move(function)](Task&) {
397397
function();
398398
}

0 commit comments

Comments
 (0)