use free_and_set_null macros

This commit is contained in:
KDSKardabox 2018-03-01 09:11:26 +05:30
parent 99630e954c
commit 2f9d69f67f
3 changed files with 11 additions and 20 deletions

View File

@ -180,7 +180,7 @@ SECTIONS {
src/wallclock.o(.text);
asm/rom6.o(.text);
src/pokeblock.o(.text);
src/fldeff_flash.o(.text);
src/fldeff_flash.o(.text);
asm/post_battle_event_funcs.o(.text);
src/time_events.o(.text);
src/birch_pc.o(.text);

View File

@ -75,7 +75,7 @@ static const u8 gCaveTransitionTiles[] = INCBIN_U8("graphics/misc/cave_transitio
// text
bool8 SetUpFieldMove_Flash(void)
{
if(ShouldDoBrailleFlyEffect())
if (ShouldDoBrailleFlyEffect())
{
gSpecialVar_Result = GetCursorSelectionMonId();
gUnknown_03005DB0 = FieldCallback_Teleport;

View File

@ -292,8 +292,7 @@ static void sub_81BED50(u8 taskId)
}
if(gUnknown_0203CF10[left].curr_buffer_index > (INNER_BUFFER_LENGTH - 1))
{
Free(gUnknown_0203CF10[left].buffer);
gUnknown_0203CF10[left].buffer = NULL;
FREE_AND_SET_NULL(gUnknown_0203CF10[left].buffer);
gTasks[taskId].data[2]++;
if((left % 2) == 1)
gUnknown_0203CF14[1]--;
@ -313,14 +312,10 @@ static void sub_81BED50(u8 taskId)
sub_81BEB90();
break;
case 5:
Free(gUnknown_0203CF14);
gUnknown_0203CF14 = NULL;
Free(gUnknown_0203CF10);
gUnknown_0203CF10 = NULL;
Free(gUnknown_0203CF04);
gUnknown_0203CF04 = NULL;
Free(gUnknown_0203CF08);
gUnknown_0203CF08 = NULL;
FREE_AND_SET_NULL(gUnknown_0203CF14);
FREE_AND_SET_NULL(gUnknown_0203CF10);
FREE_AND_SET_NULL(gUnknown_0203CF04);
FREE_AND_SET_NULL(gUnknown_0203CF08);
break;
case 6:
SetGpuRegBits(REG_OFFSET_BG2CNT, 0x2);
@ -742,14 +737,10 @@ static void sub_81BF028(u8 taskId)
if(gSprites[gUnknown_0203CF0C->spriteId].callback != SpriteCallbackDummy)
return;
DestroySprite(&gSprites[gUnknown_0203CF0C->spriteId]);
Free(gUnknown_0203CF0C->unkC);
gUnknown_0203CF0C->unkC = NULL;
Free(gUnknown_0203CF0C->frameImage);
gUnknown_0203CF0C->frameImage = NULL;
Free(gUnknown_0203CF0C->frameImageTiles);
gUnknown_0203CF0C->frameImageTiles = NULL;
Free(gUnknown_0203CF0C);
gUnknown_0203CF0C = NULL;
FREE_AND_SET_NULL(gUnknown_0203CF0C->unkC);;
FREE_AND_SET_NULL(gUnknown_0203CF0C->frameImage);
FREE_AND_SET_NULL(gUnknown_0203CF0C->frameImageTiles);
FREE_AND_SET_NULL(gUnknown_0203CF0C);
break;
case 8:
EnableBothScriptContexts();