tag/Id3Load, ...: use std::make_unique_for_overwrite()

Don't zero-initialize the buffers.  This removes some useless
overhead.
This commit is contained in:
Max Kellermann
2025-01-29 11:52:35 +01:00
parent a5da7fd51a
commit 57e7fb3f62
10 changed files with 13 additions and 13 deletions

View File

@@ -266,7 +266,7 @@ MadDecoder::ParseId3(size_t tagsize, Tag *mpd_tag) noexcept
id3_data = stream.this_frame;
mad_stream_skip(&(stream), tagsize);
} else {
allocated = std::make_unique<id3_byte_t[]>(tagsize);
allocated = std::make_unique_for_overwrite<id3_byte_t[]>(tagsize);
memcpy(allocated.get(), stream.this_frame, count);
mad_stream_skip(&(stream), count);

View File

@@ -101,7 +101,7 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block)
const auto kernal_path = block.GetPath("kernal");
if (!kernal_path.IsNull())
{
kernal = std::make_unique<uint8_t[]>(rom_size);
kernal = std::make_unique_for_overwrite<uint8_t[]>(rom_size);
loadRom(kernal_path, kernal.get());
}
@@ -109,7 +109,7 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block)
const auto basic_path = block.GetPath("basic");
if (!basic_path.IsNull())
{
basic = std::make_unique<uint8_t[]>(rom_size);
basic = std::make_unique_for_overwrite<uint8_t[]>(rom_size);
loadRom(basic_path, basic.get());
}
}