mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-01 01:24:34 +00:00
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:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user