Skip to content

Commit b35a4c2

Browse files
committed
cocoa_common: drop dead ui_window_cocoa_t stack declaration
-[CocoaView init] at cocoa_common.m:254 had an #if defined(HAVE_COCOA) block that declared a stack-local ui_window_cocoa_t, assigned its .data field to self, then let the variable go out of scope without passing, storing, or otherwise referencing it. Pure dead code. Confirmed unused: ui_window_cocoa_t is the payload type for the ui_window_cocoa_* driver vtable in ui_cocoa.m, but that vtable's init function returns NULL, so the other entry points never see a valid ui_window_cocoa_t anyway - unrelated pre-existing plumbing issue with the ui_window driver system, not something this commit addresses. Removing the block also lets the two surrounding #if defined(OSX) blocks merge into one, eliminating one preprocessor conditional. Zero runtime change; the generated code for -[CocoaView init] is identical modulo the unused stack slot. Caught during a HAVE_COCOA_METAL vs HAVE_COCOA convergence sweep (following 492b9c4) - one of the few remaining HAVE_COCOA-only branches turned out to be dead code rather than a real platform divergence.
1 parent 492b9c4 commit b35a4c2

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

ui/drivers/cocoa/cocoa_common.m

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,10 @@ - (id)init
249249
[self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
250250
NSArray *array = [NSArray arrayWithObjects:NSColorPboardType, NSFilenamesPboardType, nil];
251251
[self registerForDraggedTypes:array];
252-
#endif
253-
254-
#if defined(HAVE_COCOA)
255-
ui_window_cocoa_t cocoa_view;
256-
cocoa_view.data = (CocoaView*)self;
257-
#endif
258252

259-
#if defined(OSX)
260-
video_driver_display_type_set(RARCH_DISPLAY_OSX);
261-
video_driver_display_set(0);
262-
video_driver_display_userdata_set((uintptr_t)self);
253+
video_driver_display_type_set(RARCH_DISPLAY_OSX);
254+
video_driver_display_set(0);
255+
video_driver_display_userdata_set((uintptr_t)self);
263256
#endif
264257

265258
#if TARGET_OS_TV

0 commit comments

Comments
 (0)