mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Remove API's loot_cleanup() function
It's no longer required as the message string is not manually allocated, its lifetime is tied to that of the library.
This commit is contained in:
@@ -309,11 +309,6 @@ extern "C"
|
||||
*/
|
||||
LOOT_API unsigned int loot_get_error_message(const char ** const message);
|
||||
|
||||
/**
|
||||
* @brief Frees the memory allocated to the last error details string.
|
||||
*/
|
||||
LOOT_API void loot_cleanup();
|
||||
|
||||
/**@}*/
|
||||
/**********************************************************************//**
|
||||
* @name Version Functions
|
||||
|
||||
@@ -269,11 +269,6 @@ LOOT_API unsigned int loot_get_error_message(const char ** const message) {
|
||||
return loot_ok;
|
||||
}
|
||||
|
||||
// Frees memory allocated to error string.
|
||||
LOOT_API void loot_cleanup() {
|
||||
extMessageStr.clear();
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
// Version Functions
|
||||
//////////////////////////////
|
||||
|
||||
@@ -76,31 +76,6 @@ TEST(GetErrorMessage, HandlesInputCorrectly) {
|
||||
ASSERT_STREQ("Null message pointer passed.", error);
|
||||
}
|
||||
|
||||
TEST(Cleanup, CleansUpAfterError) {
|
||||
// First generate an error.
|
||||
EXPECT_EQ(loot_error_invalid_args, loot_get_error_message(NULL));
|
||||
|
||||
// Check that the error message is non-null.
|
||||
const char * error;
|
||||
EXPECT_EQ(loot_ok, loot_get_error_message(&error));
|
||||
ASSERT_STREQ("Null message pointer passed.", error);
|
||||
|
||||
ASSERT_NO_THROW(loot_cleanup());
|
||||
|
||||
// Now check that the error message pointer is null.
|
||||
error = nullptr;
|
||||
EXPECT_EQ(loot_ok, loot_get_error_message(&error));
|
||||
EXPECT_EQ(nullptr, error);
|
||||
}
|
||||
|
||||
TEST(Cleanup, HandlesNoError) {
|
||||
ASSERT_NO_THROW(loot_cleanup());
|
||||
|
||||
const char * error = nullptr;
|
||||
EXPECT_EQ(loot_ok, loot_get_error_message(&error));
|
||||
EXPECT_EQ(nullptr, error);
|
||||
}
|
||||
|
||||
TEST_F(OblivionTest, CreateDbHandlesValidInputs) {
|
||||
EXPECT_EQ(loot_ok, loot_create_db(&db, loot_game_tes4, dataPath.parent_path().string().c_str(), localPath.string().c_str()));
|
||||
ASSERT_NO_THROW(loot_destroy_db(db));
|
||||
|
||||
Reference in New Issue
Block a user