From e3c74637db2acbe7b5953f5ba03a7a40e1a0f473 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 23 Mar 2024 17:19:33 -0500 Subject: [PATCH] [turbine] Make applicationData return const& --- src/olympic/turbine/include/turbine/context.hpp | 5 ++--- src/olympic/turbine/src/gba/context.cpp | 2 +- src/olympic/turbine/src/glfw/context.cpp | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/olympic/turbine/include/turbine/context.hpp b/src/olympic/turbine/include/turbine/context.hpp index ef288747..2108f082 100644 --- a/src/olympic/turbine/include/turbine/context.hpp +++ b/src/olympic/turbine/include/turbine/context.hpp @@ -45,13 +45,12 @@ void setApplicationData(Context &ctx, T *applicationData) noexcept { } [[nodiscard]] -ox::AnyPtr &applicationDataRaw(Context &ctx) noexcept; +ox::AnyPtr const&applicationDataRaw(Context &ctx) noexcept; template [[nodiscard]] T *applicationData(Context &ctx) noexcept { - auto const ptr = applicationDataRaw(ctx); - return ptr.get(); + return applicationDataRaw(ctx).get(); } void setKeyEventHandler(Context &ctx, KeyEventHandler h) noexcept; diff --git a/src/olympic/turbine/src/gba/context.cpp b/src/olympic/turbine/src/gba/context.cpp index 389e04c2..37a4c710 100644 --- a/src/olympic/turbine/src/gba/context.cpp +++ b/src/olympic/turbine/src/gba/context.cpp @@ -22,7 +22,7 @@ void setApplicationDataRaw(Context &ctx, ox::AnyPtr const&applicationData) noexc ctx.applicationData = applicationData; } -ox::AnyPtr &applicationDataRaw(Context &ctx) noexcept { +ox::AnyPtr const&applicationDataRaw(Context &ctx) noexcept { return ctx.applicationData; } diff --git a/src/olympic/turbine/src/glfw/context.cpp b/src/olympic/turbine/src/glfw/context.cpp index 73775482..ed83f007 100644 --- a/src/olympic/turbine/src/glfw/context.cpp +++ b/src/olympic/turbine/src/glfw/context.cpp @@ -24,7 +24,7 @@ void setApplicationDataRaw(Context &ctx, ox::AnyPtr const&applicationData) noexc ctx.applicationData = applicationData; } -ox::AnyPtr &applicationDataRaw(Context &ctx) noexcept { +ox::AnyPtr const&applicationDataRaw(Context &ctx) noexcept { return ctx.applicationData; }