Codechange: Replace all usages of alloca/AllocaM with more modern/less discouraged alternatives

This commit is contained in:
Charles Pigott
2021-05-01 21:06:17 +01:00
committed by PeterN
parent b19f42ecd9
commit b282664242
18 changed files with 135 additions and 122 deletions

View File

@@ -81,8 +81,8 @@ bool LoadNewGRFSound(SoundEntry *sound)
if (file.ReadByte() != 0xFF) return false;
uint8 name_len = file.ReadByte();
char *name = AllocaM(char, name_len + 1);
file.ReadBlock(name, name_len + 1);
std::string name(name_len + 1, '\0');
file.ReadBlock(name.data(), name_len + 1);
/* Test string termination */
if (name[name_len] != 0) {