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); src/wallclock.o(.text);
asm/rom6.o(.text); asm/rom6.o(.text);
src/pokeblock.o(.text); src/pokeblock.o(.text);
src/fldeff_flash.o(.text); src/fldeff_flash.o(.text);
asm/post_battle_event_funcs.o(.text); asm/post_battle_event_funcs.o(.text);
src/time_events.o(.text); src/time_events.o(.text);
src/birch_pc.o(.text); src/birch_pc.o(.text);

View File

@ -75,7 +75,7 @@ static const u8 gCaveTransitionTiles[] = INCBIN_U8("graphics/misc/cave_transitio
// text // text
bool8 SetUpFieldMove_Flash(void) bool8 SetUpFieldMove_Flash(void)
{ {
if(ShouldDoBrailleFlyEffect()) if (ShouldDoBrailleFlyEffect())
{ {
gSpecialVar_Result = GetCursorSelectionMonId(); gSpecialVar_Result = GetCursorSelectionMonId();
gUnknown_03005DB0 = FieldCallback_Teleport; 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)) if(gUnknown_0203CF10[left].curr_buffer_index > (INNER_BUFFER_LENGTH - 1))
{ {
Free(gUnknown_0203CF10[left].buffer); FREE_AND_SET_NULL(gUnknown_0203CF10[left].buffer);
gUnknown_0203CF10[left].buffer = NULL;
gTasks[taskId].data[2]++; gTasks[taskId].data[2]++;
if((left % 2) == 1) if((left % 2) == 1)
gUnknown_0203CF14[1]--; gUnknown_0203CF14[1]--;
@ -313,14 +312,10 @@ static void sub_81BED50(u8 taskId)
sub_81BEB90(); sub_81BEB90();
break; break;
case 5: case 5:
Free(gUnknown_0203CF14); FREE_AND_SET_NULL(gUnknown_0203CF14);
gUnknown_0203CF14 = NULL; FREE_AND_SET_NULL(gUnknown_0203CF10);
Free(gUnknown_0203CF10); FREE_AND_SET_NULL(gUnknown_0203CF04);
gUnknown_0203CF10 = NULL; FREE_AND_SET_NULL(gUnknown_0203CF08);
Free(gUnknown_0203CF04);
gUnknown_0203CF04 = NULL;
Free(gUnknown_0203CF08);
gUnknown_0203CF08 = NULL;
break; break;
case 6: case 6:
SetGpuRegBits(REG_OFFSET_BG2CNT, 0x2); SetGpuRegBits(REG_OFFSET_BG2CNT, 0x2);
@ -742,14 +737,10 @@ static void sub_81BF028(u8 taskId)
if(gSprites[gUnknown_0203CF0C->spriteId].callback != SpriteCallbackDummy) if(gSprites[gUnknown_0203CF0C->spriteId].callback != SpriteCallbackDummy)
return; return;
DestroySprite(&gSprites[gUnknown_0203CF0C->spriteId]); DestroySprite(&gSprites[gUnknown_0203CF0C->spriteId]);
Free(gUnknown_0203CF0C->unkC); FREE_AND_SET_NULL(gUnknown_0203CF0C->unkC);;
gUnknown_0203CF0C->unkC = NULL; FREE_AND_SET_NULL(gUnknown_0203CF0C->frameImage);
Free(gUnknown_0203CF0C->frameImage); FREE_AND_SET_NULL(gUnknown_0203CF0C->frameImageTiles);
gUnknown_0203CF0C->frameImage = NULL; FREE_AND_SET_NULL(gUnknown_0203CF0C);
Free(gUnknown_0203CF0C->frameImageTiles);
gUnknown_0203CF0C->frameImageTiles = NULL;
Free(gUnknown_0203CF0C);
gUnknown_0203CF0C = NULL;
break; break;
case 8: case 8:
EnableBothScriptContexts(); EnableBothScriptContexts();