Change to use unique_ptr

This commit is contained in:
esuo1198
2024-03-22 23:37:55 +09:00
parent b452adeaed
commit bde5d384b6
5 changed files with 19 additions and 20 deletions
+3 -3
View File
@@ -124,8 +124,9 @@ Init () {
INSTALL_HOOK (HaspGetInfo);
INSTALL_HOOK (HaspRead);
auto configPath = std::filesystem::current_path () / "config.toml";
toml_table_t *config = openConfig (configPath);
auto configPath = std::filesystem::current_path () / "config.toml";
std::unique_ptr<toml_table_t, void (*) (toml_table_t *)> config_ptr (openConfig (configPath), toml_free);
toml_table_t *config = config_ptr.get ();
if (config) {
auto patches = openConfigSection (config, "patches");
if (patches) {
@@ -145,7 +146,6 @@ Init () {
modeCollabo026 = readConfigBool (cn_jun_2023, "mode_collabo026", modeCollabo026);
}
}
toml_free (config);
}
// Apply common config patch