mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Use the FREE_AND_SET_NULL macro where appropriate
This commit is contained in:
parent
d03756dfd2
commit
284e46927a
@ -594,8 +594,7 @@ static void StatsChangeAnimation_Step3(u8 taskId)
|
||||
if (gTasks[taskId].data[6] == 1)
|
||||
gSprites[gTasks[taskId].data[7]].oam.priority++;
|
||||
|
||||
Free(sAnimStatsChangeData);
|
||||
sAnimStatsChangeData = NULL;
|
||||
FREE_AND_SET_NULL(sAnimStatsChangeData);
|
||||
DestroyAnimVisualTask(taskId);
|
||||
break;
|
||||
}
|
||||
|
@ -1498,8 +1498,7 @@ static void CB2_PreInitMultiBattle(void)
|
||||
gBattleTypeFlags = *savedBattleTypeFlags;
|
||||
gMain.savedCallback = *savedCallback;
|
||||
SetMainCallback2(CB2_InitBattleInternal);
|
||||
Free(sMultiPartnerPartyBuffer);
|
||||
sMultiPartnerPartyBuffer = NULL;
|
||||
FREE_AND_SET_NULL(sMultiPartnerPartyBuffer);
|
||||
}
|
||||
}
|
||||
else if (gReceivedRemoteLinkPlayers == 0)
|
||||
@ -1507,8 +1506,7 @@ static void CB2_PreInitMultiBattle(void)
|
||||
gBattleTypeFlags = *savedBattleTypeFlags;
|
||||
gMain.savedCallback = *savedCallback;
|
||||
SetMainCallback2(CB2_InitBattleInternal);
|
||||
Free(sMultiPartnerPartyBuffer);
|
||||
sMultiPartnerPartyBuffer = NULL;
|
||||
FREE_AND_SET_NULL(sMultiPartnerPartyBuffer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1544,8 +1542,7 @@ static void CB2_PreInitIngamePlayerPartnerBattle(void)
|
||||
gBattleTypeFlags = *savedBattleTypeFlags;
|
||||
gMain.savedCallback = *savedCallback;
|
||||
SetMainCallback2(CB2_InitBattleInternal);
|
||||
Free(sMultiPartnerPartyBuffer);
|
||||
sMultiPartnerPartyBuffer = NULL;
|
||||
FREE_AND_SET_NULL(sMultiPartnerPartyBuffer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -816,8 +816,7 @@ static void Task_EvolutionScene(u8 taskId)
|
||||
|
||||
DestroyTask(taskId);
|
||||
FreeMonSpritesGfx();
|
||||
Free(sEvoStructPtr);
|
||||
sEvoStructPtr = NULL;
|
||||
FREE_AND_SET_NULL(sEvoStructPtr);
|
||||
FreeAllWindowBuffers();
|
||||
SetMainCallback2(gCB2_AfterEvolution);
|
||||
}
|
||||
@ -1223,8 +1222,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
|
||||
if (!IsTextPrinterActive(0))
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
Free(sEvoStructPtr);
|
||||
sEvoStructPtr = NULL;
|
||||
FREE_AND_SET_NULL(sEvoStructPtr);
|
||||
gTextFlags.useAlternateDownArrow = 0;
|
||||
SetMainCallback2(gCB2_AfterEvolution);
|
||||
}
|
||||
|
@ -44,8 +44,7 @@ u32 MysteryGiftClient_Run(u16 * endVal)
|
||||
{
|
||||
*endVal = sClient->param;
|
||||
MysteryGiftClient_Free(sClient);
|
||||
Free(sClient);
|
||||
sClient = NULL;
|
||||
FREE_AND_SET_NULL(sClient);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -44,8 +44,7 @@ u32 MysterGiftServer_Run(u16 * endVal)
|
||||
{
|
||||
*endVal = sServer->param;
|
||||
MysteryGiftServer_Free(sServer);
|
||||
Free(sServer);
|
||||
sServer = NULL;
|
||||
FREE_AND_SET_NULL(sServer);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -207,8 +207,7 @@ void WonderCard_Destroy(void)
|
||||
if (sWonderCardData != NULL)
|
||||
{
|
||||
*sWonderCardData = (struct WonderCardData){};
|
||||
Free(sWonderCardData);
|
||||
sWonderCardData = NULL;
|
||||
FREE_AND_SET_NULL(sWonderCardData);
|
||||
}
|
||||
}
|
||||
|
||||
@ -660,8 +659,7 @@ void WonderNews_Destroy(void)
|
||||
if (sWonderNewsData != NULL)
|
||||
{
|
||||
*sWonderNewsData = (struct WonderNewsData){};
|
||||
Free(sWonderNewsData);
|
||||
sWonderNewsData = NULL;
|
||||
FREE_AND_SET_NULL(sWonderNewsData);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user