mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-23 04:41:12 +00:00
ams: convert to util::ConstructAt where appropriate
This commit is contained in:
parent
d84dcb653d
commit
c99ce36d7d
4 changed files with 7 additions and 12 deletions
|
@ -40,12 +40,10 @@ namespace ams::fs {
|
||||||
|
|
||||||
/* Setup the storage. */
|
/* Setup the storage. */
|
||||||
/* NOTE: This owns the file, and so on failure it will be closed appropriately. */
|
/* 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 = util::ConstructAtGuarded(g_stratosphere_romfs_storage, stratosphere_romfs_file, true);
|
||||||
auto storage_guard = SCOPE_GUARD { std::destroy_at(GetPointer(g_stratosphere_romfs_storage)); };
|
|
||||||
|
|
||||||
/* Create the filesystem. */
|
/* Create the filesystem. */
|
||||||
std::construct_at(GetPointer(g_stratosphere_romfs_fs));
|
auto fs_guard = util::ConstructAtGuarded(g_stratosphere_romfs_fs);
|
||||||
auto fs_guard = SCOPE_GUARD { std::destroy_at(GetPointer(g_stratosphere_romfs_fs)); };
|
|
||||||
|
|
||||||
/* Initialize the filesystem. */
|
/* Initialize the filesystem. */
|
||||||
R_TRY(GetReference(g_stratosphere_romfs_fs).Initialize(GetPointer(g_stratosphere_romfs_storage), nullptr, 0, false));
|
R_TRY(GetReference(g_stratosphere_romfs_fs).Initialize(GetPointer(g_stratosphere_romfs_storage), nullptr, 0, false));
|
||||||
|
|
|
@ -39,11 +39,8 @@ namespace ams::htc::server {
|
||||||
/* Check that we haven't already initialized. */
|
/* Check that we haven't already initialized. */
|
||||||
AMS_ASSERT(g_server_manager == nullptr);
|
AMS_ASSERT(g_server_manager == nullptr);
|
||||||
|
|
||||||
/* Create the server manager. */
|
/* Create/Set the server manager pointer. */
|
||||||
std::construct_at(GetPointer(g_server_manager_storage));
|
g_server_manager = util::ConstructAt(g_server_manager_storage);
|
||||||
|
|
||||||
/* Set the server manager pointer. */
|
|
||||||
g_server_manager = GetPointer(g_server_manager_storage);
|
|
||||||
|
|
||||||
/* Create and register the htc manager object. */
|
/* Create and register the htc manager object. */
|
||||||
HtcServiceObject *service_object;
|
HtcServiceObject *service_object;
|
||||||
|
|
|
@ -28,13 +28,13 @@ namespace ams::htcfs {
|
||||||
void InitializeClient(htclow::HtclowManager *manager) {
|
void InitializeClient(htclow::HtclowManager *manager) {
|
||||||
AMS_ASSERT(!g_initialized);
|
AMS_ASSERT(!g_initialized);
|
||||||
|
|
||||||
std::construct_at(GetPointer(g_client_storage), manager);
|
util::ConstructAt(g_client_storage, manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FinalizeClient() {
|
void FinalizeClient() {
|
||||||
AMS_ASSERT(g_initialized);
|
AMS_ASSERT(g_initialized);
|
||||||
|
|
||||||
std::destroy_at(GetPointer(g_client_storage));
|
util::DestroyAt(g_client_storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
Client &GetClient() {
|
Client &GetClient() {
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace ams::htclow::mux {
|
||||||
R_UNLESS(idx < MaxChannelCount, htclow::ResultOutOfChannel());
|
R_UNLESS(idx < MaxChannelCount, htclow::ResultOutOfChannel());
|
||||||
|
|
||||||
/* Create the channel impl. */
|
/* 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. */
|
/* Mark the storage valid. */
|
||||||
m_storage_valid[idx] = true;
|
m_storage_valid[idx] = true;
|
||||||
|
|
Loading…
Reference in a new issue