Skip to content

Commit c18c2d4

Browse files
JoeMattclaude
andcommitted
fix: address Copilot round-2 review on PR #126
Two small follow-ups: 1. src/m68000/m68kinterface.c: convert the four new // comments I added (m68k_done + emulation_initialized) to /* */ form per CLAUDE.md ("// allowed but prefer /* */ for new code"). 2. src/tom/gpu.c: drop the redundant `if (branch_condition_table)` guard around the free + NULL pair. free(NULL) is a no-op; the comment already documented the property. Co-Authored-By: Claude Opus 4.7 <[email protected]>
1 parent 6449910 commit c18c2d4

2 files changed

Lines changed: 11 additions & 15 deletions

File tree

src/m68000/m68kinterface.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ void M68KDebugResume(void)
7878
}
7979

8080

81-
// File-scope so m68k_done() below can reset it after freeing table68k.
81+
/* File-scope so m68k_done() below can reset it after freeing table68k. */
8282
static uint32_t emulation_initialized = 0;
8383

84-
// Symmetric counterpart to the lazy init in m68k_pulse_reset().
85-
// Defers the actual free to readcpu.c::free_table68k() so the table
86-
// is owned end-to-end by the module that allocates it (table68k is
87-
// declared in readcpu.h). Called from JaguarDone() so ASAN sees a
88-
// clean shutdown.
84+
/* Symmetric counterpart to the lazy init in m68k_pulse_reset().
85+
* Defers the actual free to readcpu.c::free_table68k() so the table
86+
* is owned end-to-end by the module that allocates it (table68k is
87+
* declared in readcpu.h). Called from JaguarDone() so ASAN sees a
88+
* clean shutdown. */
8989
void m68k_done(void)
9090
{
9191
free_table68k();

src/tom/gpu.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -645,15 +645,11 @@ void GPUInit(void)
645645
void GPUDone(void)
646646
{
647647
/* Release the branch-condition LUT so process-lifetime ASAN runs
648-
* don't report it as a leak. Safe to call without a matching
649-
* GPUInit (free(NULL) is a no-op) and safe to re-call after a
650-
* subsequent GPUInit (build_branch_condition_table early-outs on
651-
* non-NULL pointer). */
652-
if (branch_condition_table)
653-
{
654-
free(branch_condition_table);
655-
branch_condition_table = NULL;
656-
}
648+
* don't report it as a leak. Unconditional: free(NULL) is a
649+
* no-op, and a subsequent GPUInit() re-allocates cleanly because
650+
* build_branch_condition_table() early-outs on non-NULL pointer. */
651+
free(branch_condition_table);
652+
branch_condition_table = NULL;
657653
}
658654

659655
void GPUReset(void)

0 commit comments

Comments
 (0)