ipc_helpers: Make PushStaticBuffer take std::vector by value
Allows interfaces to move the vector into the calls, avoiding any reallocations. Many existing call sites already std::move into the parameter, expecting a move to occur. Only a few remain where this wasn't already being done, which we can convert over.
This commit is contained in:
@@ -155,13 +155,14 @@ void DSP_DSP::ReadPipeIfPossible(Kernel::HLERequestContext& ctx) {
|
||||
const u16 pipe_readable_size = static_cast<u16>(system.DSP().GetPipeReadableSize(pipe));
|
||||
|
||||
std::vector<u8> pipe_buffer;
|
||||
if (pipe_readable_size >= size)
|
||||
if (pipe_readable_size >= size) {
|
||||
pipe_buffer = system.DSP().PipeRead(pipe, size);
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push<u16>(pipe_readable_size);
|
||||
rb.PushStaticBuffer(pipe_buffer, 0);
|
||||
rb.PushStaticBuffer(std::move(pipe_buffer), 0);
|
||||
|
||||
LOG_DEBUG(Service_DSP, "channel={}, peer={}, size=0x{:04X}, pipe_readable_size=0x{:04X}",
|
||||
channel, peer, size, pipe_readable_size);
|
||||
|
||||
Reference in New Issue
Block a user