ams: convert to util::ConstructAt where appropriate

This commit is contained in:
Michael Scire 2021-03-21 20:36:49 -07:00
parent d84dcb653d
commit c99ce36d7d
4 changed files with 7 additions and 12 deletions

View file

@ -40,12 +40,10 @@ namespace ams::fs {
/* Setup the storage. */
/* NOTE: This owns the file, and so on failure it will be closed appropriately. */
std::construct_at(GetPointer(g_stratosphere_romfs_storage), stratosphere_romfs_file, true);
auto storage_guard = SCOPE_GUARD { std::destroy_at(GetPointer(g_stratosphere_romfs_storage)); };
auto storage_guard = util::ConstructAtGuarded(g_stratosphere_romfs_storage, stratosphere_romfs_file, true);
/* Create the filesystem. */
std::construct_at(GetPointer(g_stratosphere_romfs_fs));
auto fs_guard = SCOPE_GUARD { std::destroy_at(GetPointer(g_stratosphere_romfs_fs)); };
auto fs_guard = util::ConstructAtGuarded(g_stratosphere_romfs_fs);
/* Initialize the filesystem. */
R_TRY(GetReference(g_stratosphere_romfs_fs).Initialize(GetPointer(g_stratosphere_romfs_storage), nullptr, 0, false));

View file

@ -39,11 +39,8 @@ namespace ams::htc::server {
/* Check that we haven't already initialized. */
AMS_ASSERT(g_server_manager == nullptr);
/* Create the server manager. */
std::construct_at(GetPointer(g_server_manager_storage));
/* Set the server manager pointer. */
g_server_manager = GetPointer(g_server_manager_storage);
/* Create/Set the server manager pointer. */
g_server_manager = util::ConstructAt(g_server_manager_storage);
/* Create and register the htc manager object. */
HtcServiceObject *service_object;

View file

@ -28,13 +28,13 @@ namespace ams::htcfs {
void InitializeClient(htclow::HtclowManager *manager) {
AMS_ASSERT(!g_initialized);
std::construct_at(GetPointer(g_client_storage), manager);
util::ConstructAt(g_client_storage, manager);
}
void FinalizeClient() {
AMS_ASSERT(g_initialized);
std::destroy_at(GetPointer(g_client_storage));
util::DestroyAt(g_client_storage);
}
Client &GetClient() {

View file

@ -56,7 +56,7 @@ namespace ams::htclow::mux {
R_UNLESS(idx < MaxChannelCount, htclow::ResultOutOfChannel());
/* Create the channel impl. */
std::construct_at(GetPointer(m_channel_storage[idx]), channel, m_packet_factory, m_state_machine, m_task_manager, m_event);
util::ConstructAt(m_channel_storage[idx], channel, m_packet_factory, m_state_machine, m_task_manager, m_event);
/* Mark the storage valid. */
m_storage_valid[idx] = true;