diff options
| author | lizzie <lizzie@eden-emu.dev> | 2026-09-25 07:54:49 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-09-25 07:54:49 +0200 |
| commit | bebc19da3253f13ceb5abfe8560cdbdc32ea7d8a (patch) | |
| tree | 3119f32d2873ee0d00ebde7208939045d1edb9dd /src/common/scratch_buffer.h | |
| parent | 99bf8cf51afb7b367cb5003f11a797499c71d13c (diff) | |
[common] Use `std::make_unique_for_overwrite<T>` in ScratchBuffer, remove polyfill (#4432)
Original `make_unique_for_overwrite.h` is well defined acc. to standard https://en.cppreference.com/cpp/memory/unique_ptr/make_unique, but by now most libc++ supports the function, so no need for polyfill.
Test that this didn't break anything (for example, Megaman game that has video at the start), or anything using VIC/IPC.
Signed-off-by: lizzie <lizzie@eden-emu.dev>
- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md)
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.
-------------------
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4432
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Diffstat (limited to 'src/common/scratch_buffer.h')
| -rw-r--r-- | src/common/scratch_buffer.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/scratch_buffer.h b/src/common/scratch_buffer.h index 8c1f566301..929a65609a 100644 --- a/src/common/scratch_buffer.h +++ b/src/common/scratch_buffer.h @@ -8,8 +8,7 @@ #include <iterator> #include <cstring> - -#include "common/make_unique_for_overwrite.h" +#include <memory> namespace Common { @@ -38,8 +37,9 @@ public: ScratchBuffer() = default; explicit ScratchBuffer(size_type initial_capacity) - : last_requested_size{initial_capacity}, buffer_capacity{initial_capacity}, - buffer{Common::make_unique_for_overwrite<T[]>(initial_capacity)} {} + : last_requested_size{initial_capacity} + , buffer_capacity{initial_capacity} + , buffer{std::make_unique_for_overwrite<T[]>(initial_capacity)} {} ~ScratchBuffer() = default; ScratchBuffer(const ScratchBuffer&) = delete; @@ -64,7 +64,7 @@ public: /// The previously held data will remain intact. void resize(size_type size) { if (size > buffer_capacity) { - auto new_buffer = Common::make_unique_for_overwrite<T[]>(size); + auto new_buffer = std::make_unique_for_overwrite<T[]>(size); std::memcpy(new_buffer.get(), buffer.get(), buffer_capacity * sizeof(T)); buffer = std::move(new_buffer); buffer_capacity = size; @@ -77,7 +77,7 @@ public: void resize_destructive(size_type size) { if (size > buffer_capacity) { buffer_capacity = size; - buffer = Common::make_unique_for_overwrite<T[]>(buffer_capacity); + buffer = std::make_unique_for_overwrite<T[]>(buffer_capacity); } last_requested_size = size; } |
