tag/Id3Load, ...: use std::make_unique_for_overwrite()
Don't zero-initialize the buffers. This removes some useless overhead.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user