Removed calloc macro

This commit is contained in:
Eduardo Quezada 2022-09-16 20:34:22 -03:00
parent 63156b4398
commit e412ec30a0
6 changed files with 7 additions and 8 deletions

View File

@ -2,7 +2,6 @@
#define GUARD_ALLOC_H
#define HEAP_SIZE 0x1C000
#define calloc(ct, sz) AllocZeroed((ct) * (sz))
#define free Free
#define FREE_AND_SET_NULL(ptr) \

View File

@ -2271,7 +2271,7 @@ static void Fill1PRecords(struct RankingHall1P *dst, s32 hallFacilityId, s32 lvl
{
s32 i, j;
struct RankingHall1P record1P[HALL_RECORDS_COUNT + 1];
struct PlayerHallRecords *playerHallRecords = calloc(1, sizeof(struct PlayerHallRecords));
struct PlayerHallRecords *playerHallRecords = AllocZeroed(sizeof(struct PlayerHallRecords));
GetPlayerHallRecords(playerHallRecords);
for (i = 0; i < HALL_RECORDS_COUNT; i++)
@ -2305,7 +2305,7 @@ static void Fill2PRecords(struct RankingHall2P *dst, s32 lvlMode)
{
s32 i, j;
struct RankingHall2P record2P[HALL_RECORDS_COUNT + 1];
struct PlayerHallRecords *playerHallRecords = calloc(1, sizeof(struct PlayerHallRecords));
struct PlayerHallRecords *playerHallRecords = AllocZeroed(sizeof(struct PlayerHallRecords));
GetPlayerHallRecords(playerHallRecords);
for (i = 0; i < HALL_RECORDS_COUNT; i++)
@ -2421,7 +2421,7 @@ void ClearRankingHallRecords(void)
void SaveGameFrontier(void)
{
s32 i;
struct Pokemon *monsParty = calloc(PARTY_SIZE, sizeof(struct Pokemon));
struct Pokemon *monsParty = AllocZeroed(sizeof(struct Pokemon) * PARTY_SIZE);
for (i = 0; i < PARTY_SIZE; i++)
monsParty[i] = gPlayerParty[i];

View File

@ -913,7 +913,7 @@ void SaveLinkTrainerNames(void)
s32 j;
s32 nextSpace;
s32 connectedTrainerRecordIndices[MAX_RFU_PLAYERS];
struct TrainerNameRecord *newRecords = calloc(ARRAY_COUNT(gSaveBlock1Ptr->trainerNameRecords), sizeof(struct TrainerNameRecord));
struct TrainerNameRecord *newRecords = AllocZeroed(sizeof(gSaveBlock1Ptr->trainerNameRecords));
// Check if we already have a record saved for connected trainers.
for (i = 0; i < GetLinkPlayerCount(); i++)

View File

@ -448,7 +448,7 @@ void ReadMail(struct Mail *mail, void (*exitCallback)(void), bool8 hasText)
u16 buffer[2];
u16 species;
sMailRead = calloc(1, sizeof(*sMailRead));
sMailRead = AllocZeroed(sizeof(*sMailRead));
sMailRead->language = GAME_LANGUAGE;
sMailRead->international = TRUE;
sMailRead->parserSingle = CopyEasyChatWord;

View File

@ -921,7 +921,7 @@ static void Task_ShowSecretBaseRegistryMenu(u8 taskId)
tSelectedRow = 0;
tScrollOffset = 0;
ClearDialogWindowAndFrame(0, FALSE);
sRegistryMenu = calloc(1, sizeof(*sRegistryMenu));
sRegistryMenu = AllocZeroed(sizeof(*sRegistryMenu));
tMainWindowId = AddWindow(&sRegistryWindowTemplates[0]);
BuildRegistryMenuItems(taskId);
FinalizeRegistryMenu(taskId);

View File

@ -3966,7 +3966,7 @@ static void TranslateShowNames(TVShow *show, u32 language)
int i;
TVShow **shows;
shows = calloc(11, sizeof(TVShow *));
shows = AllocZeroed(sizeof(TVShow *) * 11);
for (i = 0; i < LAST_TVSHOW_IDX; i++)
{
switch (show[i].common.kind)