From 0b2e4ebc584db6d358b3864c80cf1694337c31ab Mon Sep 17 00:00:00 2001 From: mzxrules Date: Sun, 21 Dec 2025 04:17:43 -0500 Subject: [PATCH] Tharo's suggestion --- include/gfxalloc.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/include/gfxalloc.h b/include/gfxalloc.h index 692d2bf3b1..2480571d1d 100644 --- a/include/gfxalloc.h +++ b/include/gfxalloc.h @@ -9,16 +9,18 @@ Gfx* Gfx_Close(Gfx* gfxDisp, Gfx* gfxAllocDisp); void* Gfx_Alloc(Gfx** gfxP, u32 size); /** - * Creates a new temporary graphics display list pointer, using the memory reserved by POLY_OPA_DISP + * Creates a new temporary graphics display list pointer, using the memory reserved by POLY_OPA_DISP. * POLY_OPA_DISP cannot be written to until GFX_ALLOC_CLOSE is called. * * @param gfxAllocDisp is the new temporary graphics display list pointer. * @param tempGfx is an intermediate Gfx* variable that should not be touched. * @param disp is the top level display list that is being given more memory. */ -#define GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, disp) \ - gfxAllocDisp = Gfx_Open(tempGfx = POLY_OPA_DISP); \ - gSPDisplayList(disp++, gfxAllocDisp) +#define GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, disp) \ + { \ + (gfxAllocDisp) = Gfx_Open((tempGfx) = POLY_OPA_DISP); \ + gSPDisplayList((disp)++, (gfxAllocDisp)); \ + (void)0 /** * Closes the graphics display list created by GFX_ALLOC_OPEN. @@ -27,8 +29,9 @@ void* Gfx_Alloc(Gfx** gfxP, u32 size); * @param tempGfx is the same Gfx* variable that was passed into GFX_ALLOC_OPEN */ #define GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx) \ - gSPEndDisplayList(gfxAllocDisp++); \ - Gfx_Close(tempGfx, gfxAllocDisp); \ - POLY_OPA_DISP = gfxAllocDisp + gSPEndDisplayList((gfxAllocDisp)++); \ + Gfx_Close((tempGfx), (gfxAllocDisp)); \ + POLY_OPA_DISP = (gfxAllocDisp); \ + }(void)0 #endif