mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-11-28 07:34:15 +01:00
Allocate StorageItemRoot directly on list
This commit is contained in:
parent
c6708dce46
commit
f7c9dc445c
@ -400,7 +400,9 @@ namespace StorageUtils {
|
|||||||
namespace API {
|
namespace API {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
WUPSStorageError OpenStorage(std::string_view plugin_id, wups_storage_root_item &outItem) {
|
WUPSStorageError OpenStorage(std::string_view plugin_id, wups_storage_root_item &outItem) {
|
||||||
StorageItemRoot root(plugin_id);
|
std::lock_guard lock(gStorageMutex);
|
||||||
|
gStorage.emplace_front(plugin_id);
|
||||||
|
auto &root = gStorage.front();
|
||||||
|
|
||||||
WUPSStorageError err = Helper::LoadFromFile(plugin_id, root);
|
WUPSStorageError err = Helper::LoadFromFile(plugin_id, root);
|
||||||
if (err == WUPS_STORAGE_ERROR_NOT_FOUND) {
|
if (err == WUPS_STORAGE_ERROR_NOT_FOUND) {
|
||||||
@ -408,14 +410,11 @@ namespace StorageUtils {
|
|||||||
root = StorageItemRoot(plugin_id);
|
root = StorageItemRoot(plugin_id);
|
||||||
} else if (err != WUPS_STORAGE_ERROR_SUCCESS) {
|
} else if (err != WUPS_STORAGE_ERROR_SUCCESS) {
|
||||||
// Return on any other error
|
// Return on any other error
|
||||||
|
gStorage.pop_front();
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
outItem = (wups_storage_root_item) root.getHandle();
|
outItem = (wups_storage_root_item) root.getHandle();
|
||||||
{
|
|
||||||
std::lock_guard lock(gStorageMutex);
|
|
||||||
gStorage.push_front(std::move(root));
|
|
||||||
}
|
|
||||||
|
|
||||||
return WUPS_STORAGE_ERROR_SUCCESS;
|
return WUPS_STORAGE_ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user