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

From 98678b5d8ded1f9100d3de9e409362a372ebef7b Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 29 Dec 2022 15:07:59 -0800
Subject: [PATCH] SDL API renaming: SDL_Alloc*/SDL_Free* ->
 SDL_Create*/SDL_Destroy*

Fixes https://github.com/libsdl-org/SDL/issues/6945
---
 docs/README-migration.md          | 11 +++++++++--
 include/SDL3/SDL_mouse.h          | 14 +++++++-------
 include/SDL3/SDL_oldnames.h       | 10 ++++++++++
 include/SDL3/SDL_rwops.h          | 20 ++++++++++----------
 src/dynapi/SDL_dynapi.sym         |  6 +++---
 src/dynapi/SDL_dynapi_overrides.h |  6 +++---
 src/dynapi/SDL_dynapi_procs.h     |  6 +++---
 src/events/SDL_mouse.c            |  4 ++--
 src/file/SDL_rwops.c              | 28 ++++++++++++++--------------
 test/testautomation_mouse.c       | 24 ++++++++++++------------
 test/testautomation_rwops.c       | 14 +++++++-------
 test/testcustomcursor.c           |  2 +-
 test/testfile.c                   |  2 +-
 test/testwm2.c                    |  4 ++--
 14 files changed, 84 insertions(+), 67 deletions(-)

diff --git a/docs/README-migration.md b/docs/README-migration.md
index d930b7da8dc7..2f377d34e6f1 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -411,6 +411,9 @@ used by additional platforms that didn't have a SDL_RunApp-like function before)
 
 SDL_ShowCursor() has been split into three functions: SDL_ShowCursor(), SDL_HideCursor(), and SDL_CursorVisible()
 
+The following functions have been renamed:
+* SDL_FreeCursor() => SDL_DestroyCursor()
+
 ## SDL_pixels.h
 
 SDL_CalculateGammaRamp has been removed, because SDL_SetWindowGammaRamp has been removed as well due to poor support in modern operating systems (see [SDL_video.h](#sdl_videoh)).
@@ -624,7 +627,7 @@ stdio_close(SDL_RWops * context)
                 status = SDL_Error(SDL_EFWRITE);
             }
         }
-        SDL_FreeRW(context);
+        SDL_DestroyRW(context);
     }
     return status;
 }
@@ -634,7 +637,7 @@ SDL_RWFromFP(void *fp, SDL_bool autoclose)
 {
     SDL_RWops *rwops = NULL;
 
-    rwops = SDL_AllocRW();
+    rwops = SDL_CreateRW();
     if (rwops != NULL) {
         rwops->size = stdio_size;
         rwops->seek = stdio_seek;
@@ -650,6 +653,10 @@ SDL_RWFromFP(void *fp, SDL_bool autoclose)

+The following functions have been renamed:
+* SDL_AllocRW() => SDL_CreateRW()
+* SDL_FreeRW() => SDL_DestroyRW()
+

SDL_sensor.h

SDL_SensorID has changed from Sint32 to Uint32, with an invalid ID being 0.
diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h
index d9860680242c…ed58a76a77f1 100644
— a/include/SDL3/SDL_mouse.h
+++ b/include/SDL3/SDL_mouse.h
@@ -293,7 +293,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);

    • data=0, mask=0: transparent
    • data=1, mask=0: inverted color if possible, black if not.
    • Cursors created with this function must be freed with SDL_FreeCursor().
    • Cursors created with this function must be freed with SDL_DestroyCursor().
    • If you want to have a color cursor, or create your cursor from an
    • SDL_Surface, you should use SDL_CreateColorCursor(). Alternately, you can
      @@ -316,7 +316,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
    • \since This function is available since SDL 3.0.0.
    • \sa SDL_FreeCursor
    • \sa SDL_DestroyCursor
    • \sa SDL_SetCursor
      */
      extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
      @@ -336,7 +336,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
    • \since This function is available since SDL 3.0.0.
    • \sa SDL_CreateCursor
    • \sa SDL_FreeCursor
    • \sa SDL_DestroyCursor
      */
      extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
      int hot_x,
      @@ -351,7 +351,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
    • \since This function is available since SDL 3.0.0.
    • \sa SDL_FreeCursor
    • \sa SDL_DestroyCursor
      */
      extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);

@@ -376,7 +376,7 @@ extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);

  • Get the active cursor.
  • This function returns a pointer to the current cursor which is owned by the
    • library. It is not necessary to free the cursor with SDL_FreeCursor().
    • library. It is not necessary to free the cursor with SDL_DestroyCursor().
    • \returns the active cursor or NULL if there is no mouse.

@@ -389,7 +389,7 @@ extern DECLSPEC SDL_Cursor SDLCALL SDL_GetCursor(void);
/
*

  • Get the default cursor.
    • You do not have to call SDL_FreeCursor() on the return value,
    • You do not have to call SDL_DestroyCursor() on the return value,
    • but it is safe to do so.
    • \returns the default cursor on success or NULL on failure.
      @@ -414,7 +414,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
    • \sa SDL_CreateCursor
    • \sa SDL_CreateSystemCursor
      */
      -extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
      +extern DECLSPEC void SDLCALL SDL_DestroyCursor(SDL_Cursor * cursor);

/**

  • Show the cursor.
    diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h
    index 8a721baa0009…d8b7ad704c72 100644
    — a/include/SDL3/SDL_oldnames.h
    +++ b/include/SDL3/SDL_oldnames.h
    @@ -239,6 +239,9 @@
    #define KMOD_SCROLL SDL_KMOD_SCROLL
    #define KMOD_SHIFT SDL_KMOD_SHIFT

+/* ##SDL_mouse.h /
+#define SDL_FreeCursor SDL_DestroyCursor
+
/
##SDL_pixels.h */
#define SDL_AllocFormat SDL_CreatePixelFormat
#define SDL_AllocPalette SDL_CreatePalette
@@ -311,6 +314,8 @@
#define RW_SEEK_CUR SDL_RW_SEEK_CUR
#define RW_SEEK_END SDL_RW_SEEK_END
#define RW_SEEK_SET SDL_RW_SEEK_SET
+#define SDL_AllocRW SDL_CreateRW
+#define SDL_FreeRW SDL_DestroyRW

/* ##SDL_sensor.h */
#define SDL_NumSensors SDL_GetNumSensors
@@ -565,6 +570,9 @@
#define KMOD_SCROLL KMOD_SCROLL_renamed_SDL_KMOD_SCROLL
#define KMOD_SHIFT KMOD_SHIFT_renamed_SDL_KMOD_SHIFT

+/* ##SDL_mouse.h /
+#define SDL_FreeCursor SDL_FreeCursor_renamed_SDL_DestroyCursor
+
/
##SDL_pixels.h */
#define SDL_AllocFormat SDL_AllocFormat_renamed_SDL_CreatePixelFormat
#define SDL_AllocPalette SDL_AllocPalette_renamed_SDL_CreatePalette
@@ -637,6 +645,8 @@
#define RW_SEEK_CUR RW_SEEK_CUR_renamed_SDL_RW_SEEK_CUR
#define RW_SEEK_END RW_SEEK_END_renamed_SDL_RW_SEEK_END
#define RW_SEEK_SET RW_SEEK_SET_renamed_SDL_RW_SEEK_SET
+#define SDL_AllocRW SDL_AllocRW_renamed_SDL_CreateRW
+#define SDL_FreeRW SDL_FreeRW_renamed_SDL_DestroyRW

/* ##SDL_sensor.h */
#define SDL_SensorClose SDL_SensorClose_renamed_SDL_CloseSensor
diff --git a/include/SDL3/SDL_rwops.h b/include/SDL3/SDL_rwops.h
index 11df261e6b8b…bc92b7500add 100644
— a/include/SDL3/SDL_rwops.h
+++ b/include/SDL3/SDL_rwops.h
@@ -291,26 +291,26 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem,

  • read/write a common data source, you should use the built-in
  • implementations in SDL, like SDL_RWFromFile() or SDL_RWFromMem(), etc.
    • You must free the returned pointer with SDL_FreeRW(). Depending on your
    • You must free the returned pointer with SDL_DestroyRW(). Depending on your
    • operating system and compiler, there may be a difference between the
    • malloc() and free() your program uses and the versions SDL calls
    • internally. Trying to mix the two can cause crashing such as segmentation
    • faults. Since all SDL_RWops must free themselves when their close
    • method is called, all SDL_RWops must be allocated through this function, so
    • they can all be freed correctly with SDL_FreeRW().
    • they can all be freed correctly with SDL_DestroyRW().
    • \returns a pointer to the allocated memory on success, or NULL on failure;
    •      call SDL_GetError() for more information.
      
    • \since This function is available since SDL 3.0.0.
    • \sa SDL_FreeRW
    • \sa SDL_DestroyRW
      */
      -extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
      +extern DECLSPEC SDL_RWops *SDLCALL SDL_CreateRW(void);

/**

  • Use this function to free an SDL_RWops structure allocated by
    • SDL_AllocRW().
    • SDL_CreateRW().
    • Applications do not need to use this function unless they are providing
    • their own SDL_RWops implementation. If you just need a SDL_RWops to
      @@ -319,18 +319,18 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
    • call the close method on those SDL_RWops pointers when you are done
    • with them.
    • Only use SDL_FreeRW() on pointers returned by SDL_AllocRW(). The pointer is
    • Only use SDL_DestroyRW() on pointers returned by SDL_CreateRW(). The pointer is
    • invalid as soon as this function returns. Any extra memory allocated during
    • creation of the SDL_RWops is not freed by SDL_FreeRW(); the programmer must
    • creation of the SDL_RWops is not freed by SDL_DestroyRW(); the programmer must
    • be responsible for managing that memory in their close method.
    • \param area the SDL_RWops structure to be freed
    • \since This function is available since SDL 3.0.0.
    • \sa SDL_AllocRW
    • \sa SDL_CreateRW
      */
      -extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
      +extern DECLSPEC void SDLCALL SDL_DestroyRW(SDL_RWops * area);

#define SDL_RW_SEEK_SET 0 /< Seek from the beginning of data */
#define SDL_RW_SEEK_CUR 1 /
< Seek relative to current read point */
@@ -494,7 +494,7 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWwrite(SDL_RWops *context,
*

  • SDL_RWclose() closes and cleans up the SDL_RWops stream. It releases any
  • resources used by the stream and frees the SDL_RWops itself with
    • SDL_FreeRW(). This returns 0 on success, or -1 if the stream failed to
    • SDL_DestroyRW(). This returns 0 on success, or -1 if the stream failed to
    • flush to its output (e.g. to disk).
    • Note that if this fails to flush the stream to disk, this function reports
      diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym
      index 9b3029dd5d52…2876dea5d32c 100644
      — a/src/dynapi/SDL_dynapi.sym
      +++ b/src/dynapi/SDL_dynapi.sym
      @@ -5,7 +5,7 @@ SDL3_0.0.0 {
      SDL_AddGamepadMappingsFromRW;
      SDL_AddHintCallback;
      SDL_AddTimer;
  • SDL_AllocRW;
  • SDL_CreateRW;
    SDL_AndroidBackButton;
    SDL_AndroidGetActivity;
    SDL_AndroidGetExternalStoragePath;
    @@ -110,8 +110,8 @@ SDL3_0.0.0 {
    SDL_FlushAudioStream;
    SDL_FlushEvent;
    SDL_FlushEvents;
  • SDL_FreeCursor;
  • SDL_FreeRW;
  • SDL_DestroyCursor;
  • SDL_DestroyRW;
    SDL_GDKGetTaskQueue;
    SDL_GDKSuspendComplete;
    SDL_GL_BindTexture;
    diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
    index eddfe75a3750…1228b3ba7390 100644
    — a/src/dynapi/SDL_dynapi_overrides.h
    +++ b/src/dynapi/SDL_dynapi_overrides.h
    @@ -31,7 +31,7 @@
    #define SDL_AddGamepadMappingsFromRW SDL_AddGamepadMappingsFromRW_REAL
    #define SDL_AddHintCallback SDL_AddHintCallback_REAL
    #define SDL_AddTimer SDL_AddTimer_REAL
    -#define SDL_AllocRW SDL_AllocRW_REAL
    +#define SDL_CreateRW SDL_CreateRW_REAL
    #define SDL_AndroidBackButton SDL_AndroidBackButton_REAL
    #define SDL_AndroidGetActivity SDL_AndroidGetActivity_REAL
    #define SDL_AndroidGetExternalStoragePath SDL_AndroidGetExternalStoragePath_REAL
    @@ -136,8 +136,8 @@
    #define SDL_FlushAudioStream SDL_FlushAudioStream_REAL
    #define SDL_FlushEvent SDL_FlushEvent_REAL
    #define SDL_FlushEvents SDL_FlushEvents_REAL
    -#define SDL_FreeCursor SDL_FreeCursor_REAL
    -#define SDL_FreeRW SDL_FreeRW_REAL
    +#define SDL_DestroyCursor SDL_DestroyCursor_REAL
    +#define SDL_DestroyRW SDL_DestroyRW_REAL
    #define SDL_GDKGetTaskQueue SDL_GDKGetTaskQueue_REAL
    #define SDL_GDKSuspendComplete SDL_GDKSuspendComplete_REAL
    #define SDL_GL_BindTexture SDL_GL_BindTexture_REAL
    diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
    index b1311f7ed1d8…be0d18a6bc5c 100644
    — a/src/dynapi/SDL_dynapi_procs.h
    +++ b/src/dynapi/SDL_dynapi_procs.h
    @@ -121,7 +121,7 @@ SDL_DYNAPI_PROC(int,SDL_AddGamepadMapping,(const char *a),(a),return)
    SDL_DYNAPI_PROC(int,SDL_AddGamepadMappingsFromRW,(SDL_RWops *a, int b),(a,b),return)
    SDL_DYNAPI_PROC(void,SDL_AddHintCallback,(const char *a, SDL_HintCallback b, void c),(a,b,c),)
    SDL_DYNAPI_PROC(SDL_TimerID,SDL_AddTimer,(Uint32 a, SDL_TimerCallback b, void c),(a,b,c),return)
    -SDL_DYNAPI_PROC(SDL_RWops
    ,SDL_AllocRW,(void),(),return)
    +SDL_DYNAPI_PROC(SDL_RWops
    ,SDL_CreateRW,(void),(),return)
    SDL_DYNAPI_PROC(int,SDL_AtomicAdd,(SDL_atomic_t *a, int b),(a,b),return)
    SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCAS,(SDL_atomic_t *a, int b, int c),(a,b,c),return)
    SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCASPtr,(void **a, void *b, void *c),(a,b,c),return)
    @@ -213,8 +213,8 @@ SDL_DYNAPI_PROC(int,SDL_FlashWindow,(SDL_Window *a, SDL_FlashOperation b),(a,b),
    SDL_DYNAPI_PROC(int,SDL_FlushAudioStream,(SDL_AudioStream *a),(a),return)
    SDL_DYNAPI_PROC(void,SDL_FlushEvent,(Uint32 a),(a),)
    SDL_DYNAPI_PROC(void,SDL_FlushEvents,(Uint32 a, Uint32 b),(a,b),)
    -SDL_DYNAPI_PROC(void,SDL_FreeCursor,(SDL_Cursor *a),(a),)
    -SDL_DYNAPI_PROC(void,SDL_FreeRW,(SDL_RWops *a),(a),)
    +SDL_DYNAPI_PROC(void,SDL_DestroyCursor,(SDL_Cursor *a),(a),)
    +SDL_DYNAPI_PROC(void,SDL_DestroyRW,(SDL_RWops *a),(a),)
    SDL_DYNAPI_PROC(int,SDL_GL_BindTexture,(SDL_Texture *a, float *b, float *c),(a,b,c),return)
    SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_CreateContext,(SDL_Window *a),(a),return)
    SDL_DYNAPI_PROC(void,SDL_GL_DeleteContext,(SDL_GLContext a),(a),)
    diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
    index 1410b88ed280…b6e47ce96301 100644
    — a/src/events/SDL_mouse.c
    +++ b/src/events/SDL_mouse.c
    @@ -883,7 +883,7 @@ void SDL_QuitMouse(void)
    cursor = mouse->cursors;
    while (cursor) {
    next = cursor->next;
  •    SDL_FreeCursor(cursor);
    
  •    SDL_DestroyCursor(cursor);
       cursor = next;
    
    }
    mouse->cursors = NULL;
    @@ -1380,7 +1380,7 @@ SDL_GetDefaultCursor(void)
    return mouse->def_cursor;
    }

-void SDL_FreeCursor(SDL_Cursor *cursor)
+void SDL_DestroyCursor(SDL_Cursor *cursor)
{
SDL_Mouse *mouse = SDL_GetMouse();
SDL_Cursor *curr, *prev;
diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c
index cb0ddc07d065…c714d90969a2 100644
— a/src/file/SDL_rwops.c
+++ b/src/file/SDL_rwops.c
@@ -276,7 +276,7 @@ static int SDLCALL windows_file_close(SDL_RWops *context)
}
SDL_free(context->hidden.windowsio.buffer.data);
context->hidden.windowsio.buffer.data = NULL;

  •    SDL_FreeRW(context);
    
  •    SDL_DestroyRW(context);
    
    }
    return 0;
    }
    @@ -403,7 +403,7 @@ static int SDLCALL stdio_close(SDL_RWops *context)
    status = SDL_Error(SDL_EFWRITE);
    }
    }
  •    SDL_FreeRW(context);
    
  •    SDL_DestroyRW(context);
    
    }
    return status;
    }
    @@ -412,7 +412,7 @@ static SDL_RWops *SDL_RWFromFP(void *fp, SDL_bool autoclose)
    {
    SDL_RWops *rwops = NULL;
  • rwops = SDL_AllocRW();
  • rwops = SDL_CreateRW();
    if (rwops != NULL) {
    rwops->size = stdio_size;
    rwops->seek = stdio_seek;
    @@ -493,7 +493,7 @@ mem_writeconst(SDL_RWops *context, const void *ptr, Sint64 size)
    static int SDLCALL mem_close(SDL_RWops *context)
    {
    if (context) {
  •    SDL_FreeRW(context);
    
  •    SDL_DestroyRW(context);
    

    }
    return 0;
    }
    @@ -536,13 +536,13 @@ SDL_RWFromFile(const char *file, const char mode)
    #endif /
    HAVE_STDIO_H */

    /* Try to open the file from the asset system */

  • rwops = SDL_AllocRW();
  • rwops = SDL_CreateRW();
    if (rwops == NULL) {
  •    return NULL; /* SDL_SetError already setup by SDL_AllocRW() */
    
  •    return NULL; /* SDL_SetError already setup by SDL_CreateRW() */
    

    }

    if (Android_JNI_FileOpen(rwops, file, mode) < 0) {

  •    SDL_FreeRW(rwops);
    
  •    SDL_DestroyRW(rwops);
       return NULL;
    
    }
    rwops->size = Android_JNI_FileSize;
    @@ -553,13 +553,13 @@ SDL_RWFromFile(const char *file, const char *mode)
    rwops->type = SDL_RWOPS_JNIFILE;

#elif defined(WIN32) || defined(GDK)

  • rwops = SDL_AllocRW();
  • rwops = SDL_CreateRW();
    if (rwops == NULL) {
  •    return NULL; /* SDL_SetError already setup by SDL_AllocRW() */
    
  •    return NULL; /* SDL_SetError already setup by SDL_CreateRW() */
    

    }

    if (windows_file_open(rwops, file, mode) < 0) {

  •    SDL_FreeRW(rwops);
    
  •    SDL_DestroyRW(rwops);
       return NULL;
    
    }
    rwops->size = windows_file_size;
    @@ -606,7 +606,7 @@ SDL_RWFromMem(void *mem, int size)
    return rwops;
    }
  • rwops = SDL_AllocRW();
  • rwops = SDL_CreateRW();
    if (rwops != NULL) {
    rwops->size = mem_size;
    rwops->seek = mem_seek;
    @@ -634,7 +634,7 @@ SDL_RWFromConstMem(const void *mem, int size)
    return rwops;
    }
  • rwops = SDL_AllocRW();
  • rwops = SDL_CreateRW();
    if (rwops != NULL) {
    rwops->size = mem_size;
    rwops->seek = mem_seek;
    @@ -650,7 +650,7 @@ SDL_RWFromConstMem(const void *mem, int size)
    }

SDL_RWops *
-SDL_AllocRW(void)
+SDL_CreateRW(void)
{
SDL_RWops *area;

@@ -663,7 +663,7 @@ SDL_AllocRW(void)
return area;
}

-void SDL_FreeRW(SDL_RWops *area)
+void SDL_DestroyRW(SDL_RWops *area)
{
SDL_free(area);
}
diff --git a/test/testautomation_mouse.c b/test/testautomation_mouse.c
index c592a2578e19…f35c8f1c2149 100644
— a/test/testautomation_mouse.c
+++ b/test/testautomation_mouse.c
@@ -185,10 +185,10 @@ static SDL_Cursor *initArrowCursor(const char *image[])
}

/**

    • @brief Check call to SDL_CreateCursor and SDL_FreeCursor
  • 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
  • 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 = {
diff --git a/test/testautomation_rwops.c b/test/testautomation_rwops.c
index 22b4b2c132ac…a22b274d2fb6 100644
— a/test/testautomation_rwops.c
+++ b/test/testautomation_rwops.c
@@ -387,15 +387,15 @@ int rwops_testFileWrite(void)
/**

  • @brief Tests alloc and free RW 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;
    }
    diff --git a/test/testcustomcursor.c b/test/testcustomcursor.c
    index 0de3e2655e88…a1825952c65d 100644
    — a/test/testcustomcursor.c
    +++ b/test/testcustomcursor.c
    @@ -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);

diff --git a/test/testfile.c b/test/testfile.c
index 03dbeb550ef2…0ffbe7370378 100644
— a/test/testfile.c
+++ b/test/testfile.c
@@ -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) */
    diff --git a/test/testwm2.c b/test/testwm2.c
    index 7e21255f104e…b659ebb3f7d1 100644
    — a/test/testwm2.c
    +++ b/test/testwm2.c
    @@ -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 … */