diff options
| author | 2018-07-25 17:29:49 -0400 | |
|---|---|---|
| committer | 2018-07-25 17:31:08 -0400 | |
| commit | a2cd07d0940e8bcd84d08dbf8f1d6663dc61ab6f (patch) | |
| tree | eafde8257566ad69b1c435dd84f5e9fd77a400fb | |
| parent | Merge pull request #801 from lioncash/time (diff) | |
| download | yuzu-a2cd07d0940e8bcd84d08dbf8f1d6663dc61ab6f.tar.gz yuzu-a2cd07d0940e8bcd84d08dbf8f1d6663dc61ab6f.tar.xz yuzu-a2cd07d0940e8bcd84d08dbf8f1d6663dc61ab6f.zip | |
service/nvdrv: Use std::move where applicable
Avoids unnecessary reference count increments and decrements.
In one case, we don't need to make a shared_ptr copy at all,
just to call a member function.
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index cc5cfe34e..c5d3e2fff 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <utility> | ||
| 6 | |||
| 5 | #include "core/hle/ipc_helpers.h" | 7 | #include "core/hle/ipc_helpers.h" |
| 6 | #include "core/hle/service/nvdrv/devices/nvdevice.h" | 8 | #include "core/hle/service/nvdrv/devices/nvdevice.h" |
| 7 | #include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" | 9 | #include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" |
| @@ -45,9 +47,9 @@ u32 Module::Open(std::string device_name) { | |||
| 45 | device_name); | 47 | device_name); |
| 46 | 48 | ||
| 47 | auto device = devices[device_name]; | 49 | auto device = devices[device_name]; |
| 48 | u32 fd = next_fd++; | 50 | const u32 fd = next_fd++; |
| 49 | 51 | ||
| 50 | open_files[fd] = device; | 52 | open_files[fd] = std::move(device); |
| 51 | 53 | ||
| 52 | return fd; | 54 | return fd; |
| 53 | } | 55 | } |
| @@ -56,7 +58,7 @@ u32 Module::Ioctl(u32 fd, u32_le command, const std::vector<u8>& input, std::vec | |||
| 56 | auto itr = open_files.find(fd); | 58 | auto itr = open_files.find(fd); |
| 57 | ASSERT_MSG(itr != open_files.end(), "Tried to talk to an invalid device"); | 59 | ASSERT_MSG(itr != open_files.end(), "Tried to talk to an invalid device"); |
| 58 | 60 | ||
| 59 | auto device = itr->second; | 61 | auto& device = itr->second; |
| 60 | return device->ioctl({command}, input, output); | 62 | return device->ioctl({command}, input, output); |
| 61 | } | 63 | } |
| 62 | 64 | ||