SDL API renaming: SDL_Alloc*/SDL_Free* -> SDL_Create*/SDL_Destroy*

Fixes https://github.com/libsdl-org/SDL/issues/6945
This commit is contained in:
Sam Lantinga
2022-12-29 15:07:59 -08:00
parent e1bd5bd071
commit 98678b5d8d
14 changed files with 84 additions and 67 deletions

View File

@@ -185,10 +185,10 @@ static SDL_Cursor *initArrowCursor(const char *image[])
}
/**
* @brief Check call to SDL_CreateCursor and SDL_FreeCursor
* @brief Check call to SDL_CreateCursor and SDL_DestroyCursor
*
* @sa http://wiki.libsdl.org/SDL_CreateCursor
* @sa http://wiki.libsdl.org/SDL_FreeCursor
* @sa http://wiki.libsdl.org/SDL_DestroyCursor
*/
int mouse_createFreeCursor(void *arg)
{
@@ -203,17 +203,17 @@ int mouse_createFreeCursor(void *arg)
}
/* Free cursor again */
SDL_FreeCursor(cursor);
SDLTest_AssertPass("Call to SDL_FreeCursor()");
SDL_DestroyCursor(cursor);
SDLTest_AssertPass("Call to SDL_DestroyCursor()");
return TEST_COMPLETED;
}
/**
* @brief Check call to SDL_CreateColorCursor and SDL_FreeCursor
* @brief Check call to SDL_CreateColorCursor and SDL_DestroyCursor
*
* @sa http://wiki.libsdl.org/SDL_CreateColorCursor
* @sa http://wiki.libsdl.org/SDL_FreeCursor
* @sa http://wiki.libsdl.org/SDL_DestroyCursor
*/
int mouse_createFreeColorCursor(void *arg)
{
@@ -237,8 +237,8 @@ int mouse_createFreeColorCursor(void *arg)
}
/* Free cursor again */
SDL_FreeCursor(cursor);
SDLTest_AssertPass("Call to SDL_FreeCursor()");
SDL_DestroyCursor(cursor);
SDLTest_AssertPass("Call to SDL_DestroyCursor()");
/* Clean up */
SDL_DestroySurface(face);
@@ -316,8 +316,8 @@ int mouse_setCursor(void *arg)
SDLTest_AssertPass("Call to SDL_SetCursor(NULL)");
/* Free cursor again */
SDL_FreeCursor(cursor);
SDLTest_AssertPass("Call to SDL_FreeCursor()");
SDL_DestroyCursor(cursor);
SDLTest_AssertPass("Call to SDL_DestroyCursor()");
return TEST_COMPLETED;
}
@@ -597,7 +597,7 @@ static const SDLTest_TestCaseReference mouseTest2 = {
};
static const SDLTest_TestCaseReference mouseTest3 = {
(SDLTest_TestCaseFp)mouse_createFreeCursor, "mouse_createFreeCursor", "Check call to SDL_CreateCursor and SDL_FreeCursor", TEST_ENABLED
(SDLTest_TestCaseFp)mouse_createFreeCursor, "mouse_createFreeCursor", "Check call to SDL_CreateCursor and SDL_DestroyCursor", TEST_ENABLED
};
static const SDLTest_TestCaseReference mouseTest4 = {
@@ -621,7 +621,7 @@ static const SDLTest_TestCaseReference mouseTest8 = {
};
static const SDLTest_TestCaseReference mouseTest9 = {
(SDLTest_TestCaseFp)mouse_createFreeColorCursor, "mouse_createFreeColorCursor", "Check call to SDL_CreateColorCursor and SDL_FreeCursor", TEST_ENABLED
(SDLTest_TestCaseFp)mouse_createFreeColorCursor, "mouse_createFreeColorCursor", "Check call to SDL_CreateColorCursor and SDL_DestroyCursor", TEST_ENABLED
};
static const SDLTest_TestCaseReference mouseTest10 = {

View File

@@ -387,15 +387,15 @@ int rwops_testFileWrite(void)
/**
* @brief Tests alloc and free RW context.
*
* \sa http://wiki.libsdl.org/SDL_AllocRW
* \sa http://wiki.libsdl.org/SDL_FreeRW
* \sa http://wiki.libsdl.org/SDL_CreateRW
* \sa http://wiki.libsdl.org/SDL_DestroyRW
*/
int rwops_testAllocFree(void)
{
/* Allocate context */
SDL_RWops *rw = SDL_AllocRW();
SDLTest_AssertPass("Call to SDL_AllocRW() succeeded");
SDLTest_AssertCheck(rw != NULL, "Validate result from SDL_AllocRW() is not NULL");
SDL_RWops *rw = SDL_CreateRW();
SDLTest_AssertPass("Call to SDL_CreateRW() succeeded");
SDLTest_AssertCheck(rw != NULL, "Validate result from SDL_CreateRW() is not NULL");
if (rw == NULL) {
return TEST_ABORTED;
}
@@ -406,8 +406,8 @@ int rwops_testAllocFree(void)
"Verify RWops type is SDL_RWOPS_UNKNOWN; expected: %d, got: %" SDL_PRIu32, SDL_RWOPS_UNKNOWN, rw->type);
/* Free context again */
SDL_FreeRW(rw);
SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
SDL_DestroyRW(rw);
SDLTest_AssertPass("Call to SDL_DestroyRW() succeeded");
return TEST_COMPLETED;
}

View File

@@ -317,7 +317,7 @@ int main(int argc, char *argv[])
#endif
for (i = 0; i < num_cursors; ++i) {
SDL_FreeCursor(cursors[i]);
SDL_DestroyCursor(cursors[i]);
}
quit(0);

View File

@@ -52,7 +52,7 @@ rwops_error_quit(unsigned line, SDL_RWops *rwops)
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testfile.c(%d): failed\n", line);
if (rwops) {
rwops->close(rwops); /* This calls SDL_FreeRW(rwops); */
rwops->close(rwops); /* This calls SDL_DestroyRW(rwops); */
}
cleanup();
exit(1); /* quit with rwops error (test failed) */

View File

@@ -199,7 +199,7 @@ void loop()
}
if (updateCursor) {
SDL_Log("Changing cursor to \"%s\"", cursorNames[system_cursor]);
SDL_FreeCursor(cursor);
SDL_DestroyCursor(cursor);
cursor = SDL_CreateSystemCursor((SDL_SystemCursor)system_cursor);
SDL_SetCursor(cursor);
}
@@ -287,7 +287,7 @@ int main(int argc, char *argv[])
loop();
}
#endif
SDL_FreeCursor(cursor);
SDL_DestroyCursor(cursor);
quit(0);
/* keep the compiler happy ... */