Don't automatically free temporary memory, let the application call SDL_FreeTemporaryMemory() when it's ready.
Also mark up all functions that return temporary memory with SDL_DECLSPEC_TEMP, to help people implementing language bindings. Fixes https://github.com/libsdl-org/SDL/issues/10378
This commit is contained in:
@@ -134,9 +134,6 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumCameraDrivers(void);
|
||||
* "coremedia" or "android". These never have Unicode characters, and are not
|
||||
* meant to be proper names.
|
||||
*
|
||||
* This returns temporary memory which will be automatically freed later, and
|
||||
* can be claimed with SDL_ClaimTemporaryMemory().
|
||||
*
|
||||
* \param index the index of the camera driver; the value ranges from 0 to
|
||||
* SDL_GetNumCameraDrivers() - 1.
|
||||
* \returns the name of the camera driver at the requested index, or NULL if
|
||||
@@ -148,7 +145,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumCameraDrivers(void);
|
||||
*
|
||||
* \sa SDL_GetNumCameraDrivers
|
||||
*/
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraDriver(int index);
|
||||
extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCameraDriver(int index);
|
||||
|
||||
/**
|
||||
* Get the name of the current camera driver.
|
||||
@@ -157,9 +154,6 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraDriver(int index);
|
||||
* "coremedia" or "android". These never have Unicode characters, and are not
|
||||
* meant to be proper names.
|
||||
*
|
||||
* This returns temporary memory which will be automatically freed later, and
|
||||
* can be claimed with SDL_ClaimTemporaryMemory().
|
||||
*
|
||||
* \returns the name of the current camera driver or NULL if no driver has
|
||||
* been initialized.
|
||||
*
|
||||
@@ -167,14 +161,11 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraDriver(int index);
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void);
|
||||
extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCurrentCameraDriver(void);
|
||||
|
||||
/**
|
||||
* Get a list of currently connected camera devices.
|
||||
*
|
||||
* This returns temporary memory which will be automatically freed later, and
|
||||
* can be claimed with SDL_ClaimTemporaryMemory().
|
||||
*
|
||||
* \param count a pointer filled in with the number of cameras returned, may
|
||||
* be NULL.
|
||||
* \returns a 0 terminated array of camera instance IDs or NULL on failure;
|
||||
@@ -186,7 +177,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void);
|
||||
*
|
||||
* \sa SDL_OpenCamera
|
||||
*/
|
||||
extern SDL_DECLSPEC const SDL_CameraID * SDLCALL SDL_GetCameras(int *count);
|
||||
extern SDL_DECLSPEC_TEMP const SDL_CameraID * SDLCALL SDL_GetCameras(int *count);
|
||||
|
||||
/**
|
||||
* Get the list of native formats/sizes a camera supports.
|
||||
@@ -210,9 +201,6 @@ extern SDL_DECLSPEC const SDL_CameraID * SDLCALL SDL_GetCameras(int *count);
|
||||
* there _is_ a camera until the user has given you permission to check
|
||||
* through a scary warning popup.
|
||||
*
|
||||
* This returns temporary memory which will be automatically freed later, and
|
||||
* can be claimed with SDL_ClaimTemporaryMemory().
|
||||
*
|
||||
* \param devid the camera device instance ID to query.
|
||||
* \param count a pointer filled in with the number of elements in the list,
|
||||
* may be NULL.
|
||||
@@ -226,14 +214,11 @@ extern SDL_DECLSPEC const SDL_CameraID * SDLCALL SDL_GetCameras(int *count);
|
||||
* \sa SDL_GetCameras
|
||||
* \sa SDL_OpenCamera
|
||||
*/
|
||||
extern SDL_DECLSPEC const SDL_CameraSpec * const * SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count);
|
||||
extern SDL_DECLSPEC_TEMP const SDL_CameraSpec * const * SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count);
|
||||
|
||||
/**
|
||||
* Get the human-readable device name for a camera.
|
||||
*
|
||||
* This returns temporary memory which will be automatically freed later, and
|
||||
* can be claimed with SDL_ClaimTemporaryMemory().
|
||||
*
|
||||
* \param instance_id the camera device instance ID.
|
||||
* \returns a human-readable device name or NULL on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
@@ -244,7 +229,7 @@ extern SDL_DECLSPEC const SDL_CameraSpec * const * SDLCALL SDL_GetCameraSupporte
|
||||
*
|
||||
* \sa SDL_GetCameras
|
||||
*/
|
||||
extern SDL_DECLSPEC const char * SDLCALL SDL_GetCameraName(SDL_CameraID instance_id);
|
||||
extern SDL_DECLSPEC_TEMP const char * SDLCALL SDL_GetCameraName(SDL_CameraID instance_id);
|
||||
|
||||
/**
|
||||
* Get the position of the camera in relation to the system.
|
||||
|
||||
Reference in New Issue
Block a user