From 7a21b20711e54f473584e9a78b9e132d10d33883 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 18 Jan 2025 20:57:15 -0600 Subject: [PATCH] [nostalgia/core] Replace ContextDeleter with safeDelete(Context*) --- .../modules/core/include/nostalgia/core/context.hpp | 6 ++---- src/nostalgia/modules/core/src/gba/context.cpp | 4 ++-- src/nostalgia/modules/core/src/opengl/context.cpp | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/nostalgia/modules/core/include/nostalgia/core/context.hpp b/src/nostalgia/modules/core/include/nostalgia/core/context.hpp index 9fcffb25..2f2df277 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/context.hpp +++ b/src/nostalgia/modules/core/include/nostalgia/core/context.hpp @@ -17,11 +17,9 @@ namespace nostalgia::core { class Context; -struct ContextDeleter { - void operator()(Context *p) noexcept; -}; +void safeDelete(Context *ctx) noexcept; -using ContextUPtr = ox::UPtr; +using ContextUPtr = ox::UPtr; ox::Result init(turbine::Context &tctx, InitParams const¶ms = {}) noexcept; diff --git a/src/nostalgia/modules/core/src/gba/context.cpp b/src/nostalgia/modules/core/src/gba/context.cpp index d54262d7..ab378d31 100644 --- a/src/nostalgia/modules/core/src/gba/context.cpp +++ b/src/nostalgia/modules/core/src/gba/context.cpp @@ -10,8 +10,8 @@ namespace nostalgia::core { -void ContextDeleter::operator()(Context *p) noexcept { - ox::safeDelete(p); +void safeDelete(Context *ctx) noexcept { + delete ctx; } Context::Context(turbine::Context &tctx) noexcept: turbineCtx(tctx) { diff --git a/src/nostalgia/modules/core/src/opengl/context.cpp b/src/nostalgia/modules/core/src/opengl/context.cpp index 0644e9aa..fd727bc0 100644 --- a/src/nostalgia/modules/core/src/opengl/context.cpp +++ b/src/nostalgia/modules/core/src/opengl/context.cpp @@ -7,8 +7,8 @@ namespace nostalgia::core { -void ContextDeleter::operator()(Context *p) noexcept { - ox::safeDelete(p); +void safeDelete(Context *ctx) noexcept { + delete ctx; } Context::Context(turbine::Context &tctx, InitParams const¶ms) noexcept: