From 8cab1b7094999e7b8c95fc47d23fbdc76b26b471 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Thu, 18 Jan 2024 17:07:17 -0300 Subject: [PATCH] Fixed braces style --- gflib/malloc.c | 34 +++++++++++++++++++++++----------- src/battle_anim_ghost.c | 6 ++++-- src/berry_blender.c | 3 ++- src/contest_effect.c | 3 ++- src/decompress.c | 15 ++++++++++----- src/decoration.c | 6 ++++-- src/dodrio_berry_picking.c | 21 ++++++++++++++------- src/mini_printf.c | 15 ++++++++++----- src/slot_machine.c | 3 ++- 9 files changed, 71 insertions(+), 35 deletions(-) diff --git a/gflib/malloc.c b/gflib/malloc.c index f54c751a4c..829877d892 100644 --- a/gflib/malloc.c +++ b/gflib/malloc.c @@ -55,18 +55,24 @@ void *AllocInternal(void *heapStart, u32 size) if (size & 3) size = 4 * ((size / 4) + 1); - for (;;) { + for (;;) + { // Loop through the blocks looking for unused block that's big enough. - if (!pos->flag) { + if (!pos->flag) + { foundBlockSize = pos->size; - if (foundBlockSize >= size) { - if (foundBlockSize - size < 2 * sizeof(struct MemBlock)) { + if (foundBlockSize >= size) + { + if (foundBlockSize - size < 2 * sizeof(struct MemBlock)) + { // The block isn't much bigger than the requested size, // so just use it. pos->flag = TRUE; - } else { + } + else + { // The block is significantly bigger than the requested // size, so split the rest into a separate block. foundBlockSize -= sizeof(struct MemBlock); @@ -98,15 +104,18 @@ void *AllocInternal(void *heapStart, u32 size) void FreeInternal(void *heapStart, void *pointer) { - if (pointer) { + if (pointer) + { struct MemBlock *head = (struct MemBlock *)heapStart; struct MemBlock *block = (struct MemBlock *)((u8 *)pointer - sizeof(struct MemBlock)); block->flag = FALSE; // If the freed block isn't the last one, merge with the next block // if it's not in use. - if (block->next != head) { - if (!block->next->flag) { + if (block->next != head) + { + if (!block->next->flag) + { block->size += sizeof(struct MemBlock) + block->next->size; block->next->magic = 0; block->next = block->next->next; @@ -117,8 +126,10 @@ void FreeInternal(void *heapStart, void *pointer) // If the freed block isn't the first one, merge with the previous block // if it's not in use. - if (block != head) { - if (!block->prev->flag) { + if (block != head) + { + if (!block->prev->flag) + { block->prev->next = block->next; if (block->next != head) @@ -135,7 +146,8 @@ void *AllocZeroedInternal(void *heapStart, u32 size) { void *mem = AllocInternal(heapStart, size); - if (mem != NULL) { + if (mem != NULL) + { if (size & 3) size = 4 * ((size / 4) + 1); diff --git a/src/battle_anim_ghost.c b/src/battle_anim_ghost.c index fed1325bc3..d6afd4c304 100644 --- a/src/battle_anim_ghost.c +++ b/src/battle_anim_ghost.c @@ -628,11 +628,13 @@ static void AnimTask_SpiteTargetShadow_Step1(u8 taskId) task->data[3] = 16; task->data[13] = GetAnimBattlerSpriteId(ANIM_TARGET); task->data[4] = OBJ_PLTT_ID2(gSprites[task->data[13]].oam.paletteNum); - if (position == 1) { + if (position == 1) + { u16 mask = DISPCNT_BG1_ON; mask2 = mask; } - else { + else + { u16 mask = DISPCNT_BG2_ON; mask2 = mask; } diff --git a/src/berry_blender.c b/src/berry_blender.c index 97262a4e2f..a91cafb0fb 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -2050,7 +2050,8 @@ static void UpdateSpeedFromHit(u16 cmd) switch (cmd) { case LINKCMD_BLENDER_SCORE_BEST: - if (sBerryBlender->speed < 1500) { + if (sBerryBlender->speed < 1500) + { sBerryBlender->speed += (384 / sNumPlayersToSpeedDivisor[sBerryBlender->numPlayers]); } else diff --git a/src/contest_effect.c b/src/contest_effect.c index b927943036..24de8e1692 100644 --- a/src/contest_effect.c +++ b/src/contest_effect.c @@ -138,7 +138,8 @@ static void ContestEffect_StartleFrontMon(void) u8 idx = 0; u8 a = eContestAppealResults.contestant; - if (eContestAppealResults.turnOrder[a] != 0) { + if (eContestAppealResults.turnOrder[a] != 0) + { int i; for (i = 0; i < CONTESTANT_COUNT; i++) diff --git a/src/decompress.c b/src/decompress.c index 8452f340ed..55807e89bb 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -214,7 +214,8 @@ static void UNUSED StitchObjectsOn8x8Canvas(s32 object_size, s32 object_count, u // While the remaining space will be filled with actual data if (object_size == 6) { - for (k = 0; k < 256; k++) { + for (k = 0; k < 256; k++) + { *dest = 0; dest++; } @@ -224,14 +225,16 @@ static void UNUSED StitchObjectsOn8x8Canvas(s32 object_size, s32 object_count, u { if (object_size == 6) { - for (k = 0; k < 32; k++) { + for (k = 0; k < 32; k++) + { *dest = 0; dest++; } } // Copy tile data - for (k = 0; k < 32 * object_size; k++) { + for (k = 0; k < 32 * object_size; k++) + { *dest = *src; src++; dest++; @@ -239,7 +242,8 @@ static void UNUSED StitchObjectsOn8x8Canvas(s32 object_size, s32 object_count, u if (object_size == 6) { - for (k = 0; k < 32; k++) { + for (k = 0; k < 32; k++) + { *dest = 0; dest++; } @@ -248,7 +252,8 @@ static void UNUSED StitchObjectsOn8x8Canvas(s32 object_size, s32 object_count, u if (object_size == 6) { - for (k = 0; k < 256; k++) { + for (k = 0; k < 256; k++) + { *dest = 0; dest++; } diff --git a/src/decoration.c b/src/decoration.c index f4fae6cc5e..18d6e2e680 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -1340,7 +1340,8 @@ static void DecorationItemsMenuAction_AttemptPlace(u8 taskId) else { ConvertIntToDecimalStringN(gStringVar1, sDecorationContext.size, STR_CONV_MODE_RIGHT_ALIGN, 2); - if (sDecorationContext.isPlayerRoom == FALSE) { + if (sDecorationContext.isPlayerRoom == FALSE) + { StringExpandPlaceholders(gStringVar4, gText_NoMoreDecorations); } else @@ -2254,7 +2255,8 @@ static void Task_PutAwayDecoration(u8 taskId) gTasks[taskId].tState = 1; break; case 1: - if (!gPaletteFade.active) { + if (!gPaletteFade.active) + { DrawWholeMapView(); ScriptContext_SetupScript(SecretBase_EventScript_PutAwayDecoration); ClearDialogWindowAndFrame(0, TRUE); diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 1b4500002c..ce1877c6cd 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -1091,32 +1091,39 @@ static void InitResults_Member(void) { u8 i; - switch (sGame->state) { + switch (sGame->state) + { case 0: - if (SendBlock(0, sGame->berryResults[sGame->timer], sizeof(sGame->berryResults))) { + if (SendBlock(0, sGame->berryResults[sGame->timer], sizeof(sGame->berryResults))) + { sGame->playersReceived = 0; sGame->state++; } break; case 1: - if (IsLinkTaskFinished()) { + if (IsLinkTaskFinished()) + { sGame->state++; } break; case 2: - if (AllLinkBlocksReceived()) { - for (i = 0; i < sGame->numPlayers; i++) { + if (AllLinkBlocksReceived()) + { + for (i = 0; i < sGame->numPlayers; i++) + { memcpy(sGame->berryResults, gBlockRecvBuffer, sizeof(sGame->berryResults)); sGame->playersReceived = sGame->numPlayers; } } - if (sGame->playersReceived >= sGame->numPlayers) { + if (sGame->playersReceived >= sGame->numPlayers) + { sGame->timer++; sGame->state++; } break; default: - if (WaitFanfare(TRUE)) { + if (WaitFanfare(TRUE)) + { sGame->maxBerriesPickedInRow = sGame->berryResults[sGame->multiplayerId][BERRY_IN_ROW]; SetGameFunc(FUNC_RESULTS); FadeOutAndPlayNewMapMusic(MUS_RG_VICTORY_WILD, 4); diff --git a/src/mini_printf.c b/src/mini_printf.c index 2a8c6e5cb7..cab78d7611 100644 --- a/src/mini_printf.c +++ b/src/mini_printf.c @@ -102,8 +102,10 @@ static s32 _putsAscii(char *s, s32 len, void *buf) p0 = b->buffer; /* Copy to buffer */ - for (i = 0; i < len; i++) { - if(b->pbuffer == b->buffer + b->buffer_len - 1) { + for (i = 0; i < len; i++) + { + if(b->pbuffer == b->buffer + b->buffer_len - 1) + { break; } *(b->pbuffer ++) = s[i]; @@ -125,8 +127,10 @@ static s32 _putsEncoded(char *s, s32 len, void *buf) p0 = b->buffer; /* Copy to buffer */ - for (i = 0; i < len; i++) { - if(b->pbuffer == b->buffer + b->buffer_len - 1) { + for (i = 0; i < len; i++) + { + if(b->pbuffer == b->buffer + b->buffer_len - 1) + { break; } *(b->pbuffer ++) = mini_pchar_decode(s[i]); @@ -191,7 +195,8 @@ static s32 mini_pad(char* ptr, s32 len, char pad_char, s32 pad_to, char *buffer) char * pbuffer = buffer; if(pad_to == 0) pad_to = len; - if (len > pad_to) { + if (len > pad_to) + { len = pad_to; overflow = TRUE; } diff --git a/src/slot_machine.c b/src/slot_machine.c index 5ae0f9f1d5..4941ec0c7e 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -3324,7 +3324,8 @@ static void SpriteCB_FlashMatchingLines(struct Sprite *sprite) if (sprite->sNumFullFlashes) sprite->sNumFullFlashes--; } - else if (sprite->sColor >= maxColorChange) { + else if (sprite->sColor >= maxColorChange) + { // Reached peak darkness, reverse sprite->sColorIncr = -sprite->sColorIncr; }