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:
Oliver Hamlet
2015-12-11 23:26:28 +00:00
parent f34bb35227
commit 5aab145227
3 changed files with 0 additions and 35 deletions
-5
View File
@@ -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
-5
View File
@@ -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
//////////////////////////////
-25
View File
@@ -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));