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

@@ -426,7 +426,7 @@ static void *ReadRecolourSprite(SpriteFile &file, uint num)
byte *dest = (byte *)AllocSprite(std::max(RECOLOUR_SPRITE_SIZE, num));
if (file.NeedsPaletteRemap()) {
byte *dest_tmp = AllocaM(byte, std::max(RECOLOUR_SPRITE_SIZE, num));
byte *dest_tmp = new byte[std::max(RECOLOUR_SPRITE_SIZE, num)];
/* Only a few recolour sprites are less than 257 bytes */
if (num < RECOLOUR_SPRITE_SIZE) memset(dest_tmp, 0, RECOLOUR_SPRITE_SIZE);
@@ -436,6 +436,7 @@ static void *ReadRecolourSprite(SpriteFile &file, uint num)
for (uint i = 1; i < RECOLOUR_SPRITE_SIZE; i++) {
dest[i] = _palmap_w2d[dest_tmp[_palmap_d2w[i - 1] + 1]];
}
delete[] dest_tmp;
} else {
file.ReadBlock(dest, num);
}