From b5ad74998bb9ebb9951621ee0bdf564317cb1e6e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 28 Jul 2024 07:06:22 -0700 Subject: [PATCH] Removed SDL_DECLSPEC_FREE --- include/SDL3/SDL_audio.h | 10 +++++----- include/SDL3/SDL_begin_code.h | 4 ++-- include/SDL3/SDL_camera.h | 4 ++-- include/SDL3/SDL_clipboard.h | 6 +++--- include/SDL3/SDL_filesystem.h | 4 ++-- include/SDL3/SDL_gamepad.h | 12 ++++++------ include/SDL3/SDL_haptic.h | 2 +- include/SDL3/SDL_joystick.h | 2 +- include/SDL3/SDL_keyboard.h | 2 +- include/SDL3/SDL_locale.h | 2 +- include/SDL3/SDL_mouse.h | 2 +- include/SDL3/SDL_stdinc.h | 6 +++--- include/SDL3/SDL_storage.h | 2 +- include/SDL3/SDL_touch.h | 4 ++-- include/SDL3/SDL_video.h | 8 ++++---- src/dynapi/gendynapi.py | 1 - 16 files changed, 35 insertions(+), 36 deletions(-) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index efd46c0e2e..bd3ee14aaa 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -457,7 +457,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentAudioDriver(void); * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioRecordingDevices */ -extern SDL_DECLSPEC_FREE SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices(int *count); +extern SDL_DECLSPEC SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices(int *count); /** * Get a list of currently-connected audio recording devices. @@ -486,7 +486,7 @@ extern SDL_DECLSPEC_FREE SDL_AudioDeviceID * SDLCALL SDL_GetAudioPlaybackDevices * \sa SDL_OpenAudioDevice * \sa SDL_GetAudioPlaybackDevices */ -extern SDL_DECLSPEC_FREE SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecordingDevices(int *count); +extern SDL_DECLSPEC SDL_AudioDeviceID * SDLCALL SDL_GetAudioRecordingDevices(int *count); /** * Get the human-readable name of a specific audio device. @@ -561,7 +561,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC_FREE int * SDLCALL SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count); +extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count); /** * Open a specific audio device. @@ -1111,7 +1111,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC_FREE int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count); +extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count); /** * Get the current output channel map of an audio stream. @@ -1135,7 +1135,7 @@ extern SDL_DECLSPEC_FREE int * SDLCALL SDL_GetAudioStreamInputChannelMap(SDL_Aud * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC_FREE int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream *stream, int *count); +extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioStream *stream, int *count); /** * Set the current input channel map of an audio stream. diff --git a/include/SDL3/SDL_begin_code.h b/include/SDL3/SDL_begin_code.h index 2483533b8e..ee4c9eab2a 100644 --- a/include/SDL3/SDL_begin_code.h +++ b/include/SDL3/SDL_begin_code.h @@ -69,8 +69,8 @@ #endif /* This is used to mark functions that return memory that need to be freed with SDL_free() */ -#ifndef SDL_DECLSPEC_FREE -#define SDL_DECLSPEC_FREE SDL_DECLSPEC +#ifndef SDL_DECLSPEC +#define SDL_DECLSPEC SDL_DECLSPEC #endif /* By default SDL uses the C calling convention */ diff --git a/include/SDL3/SDL_camera.h b/include/SDL3/SDL_camera.h index 77cfc3551a..46dcee1de0 100644 --- a/include/SDL3/SDL_camera.h +++ b/include/SDL3/SDL_camera.h @@ -178,7 +178,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentCameraDriver(void); * * \sa SDL_OpenCamera */ -extern SDL_DECLSPEC_FREE SDL_CameraID * SDLCALL SDL_GetCameras(int *count); +extern SDL_DECLSPEC SDL_CameraID * SDLCALL SDL_GetCameras(int *count); /** * Get the list of native formats/sizes a camera supports. @@ -217,7 +217,7 @@ extern SDL_DECLSPEC_FREE SDL_CameraID * SDLCALL SDL_GetCameras(int *count); * \sa SDL_GetCameras * \sa SDL_OpenCamera */ -extern SDL_DECLSPEC_FREE SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count); +extern SDL_DECLSPEC SDL_CameraSpec ** SDLCALL SDL_GetCameraSupportedFormats(SDL_CameraID devid, int *count); /** * Get the human-readable device name for a camera. diff --git a/include/SDL3/SDL_clipboard.h b/include/SDL3/SDL_clipboard.h index 1c1bd6bd96..ccd32011c5 100644 --- a/include/SDL3/SDL_clipboard.h +++ b/include/SDL3/SDL_clipboard.h @@ -71,7 +71,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); * \sa SDL_HasClipboardText * \sa SDL_SetClipboardText */ -extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetClipboardText(void); +extern SDL_DECLSPEC char * SDLCALL SDL_GetClipboardText(void); /** * Query whether the clipboard exists and contains a non-empty text string. @@ -114,7 +114,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text); * \sa SDL_HasPrimarySelectionText * \sa SDL_SetPrimarySelectionText */ -extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetPrimarySelectionText(void); +extern SDL_DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void); /** * Query whether the primary selection exists and contains a non-empty text @@ -225,7 +225,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ClearClipboardData(void); * \sa SDL_HasClipboardData * \sa SDL_SetClipboardData */ -extern SDL_DECLSPEC_FREE void * SDLCALL SDL_GetClipboardData(const char *mime_type, size_t *size); +extern SDL_DECLSPEC void * SDLCALL SDL_GetClipboardData(const char *mime_type, size_t *size); /** * Query whether there is data in the clipboard for the provided mime type. diff --git a/include/SDL3/SDL_filesystem.h b/include/SDL3/SDL_filesystem.h index 34b450472e..756a52dcc1 100644 --- a/include/SDL3/SDL_filesystem.h +++ b/include/SDL3/SDL_filesystem.h @@ -132,7 +132,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetBasePath(void); * * \sa SDL_GetBasePath */ -extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetPrefPath(const char *org, const char *app); +extern SDL_DECLSPEC char * SDLCALL SDL_GetPrefPath(const char *org, const char *app); /** * The type of the OS-provided default folder for a specific purpose. @@ -375,7 +375,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo * * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE char ** SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count); +extern SDL_DECLSPEC char ** SDLCALL SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_gamepad.h b/include/SDL3/SDL_gamepad.h index 1291ae77e5..cec068446e 100644 --- a/include/SDL3/SDL_gamepad.h +++ b/include/SDL3/SDL_gamepad.h @@ -398,7 +398,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_ReloadGamepadMappings(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE char ** SDLCALL SDL_GetGamepadMappings(int *count); +extern SDL_DECLSPEC char ** SDLCALL SDL_GetGamepadMappings(int *count); /** * Get the gamepad mapping string for a given GUID. @@ -413,7 +413,7 @@ extern SDL_DECLSPEC_FREE char ** SDLCALL SDL_GetGamepadMappings(int *count); * \sa SDL_GetJoystickGUIDForID * \sa SDL_GetJoystickGUID */ -extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID guid); +extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID guid); /** * Get the current mapping of a gamepad. @@ -432,7 +432,7 @@ extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID gu * \sa SDL_GetGamepadMappingForGUID * \sa SDL_SetGamepadMapping */ -extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad); +extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad); /** * Set the current mapping of a joystick or gamepad. @@ -477,7 +477,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasGamepad(void); * \sa SDL_HasGamepad * \sa SDL_OpenGamepad */ -extern SDL_DECLSPEC_FREE SDL_JoystickID * SDLCALL SDL_GetGamepads(int *count); +extern SDL_DECLSPEC SDL_JoystickID * SDLCALL SDL_GetGamepads(int *count); /** * Check if the given joystick is supported by the gamepad interface. @@ -653,7 +653,7 @@ extern SDL_DECLSPEC SDL_GamepadType SDLCALL SDL_GetRealGamepadTypeForID(SDL_Joys * \sa SDL_GetGamepads * \sa SDL_GetGamepadMapping */ -extern SDL_DECLSPEC_FREE char * SDLCALL SDL_GetGamepadMappingForID(SDL_JoystickID instance_id); +extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMappingForID(SDL_JoystickID instance_id); /** * Open a gamepad for use. @@ -1007,7 +1007,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadEventsEnabled(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE SDL_GamepadBinding ** SDLCALL SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count); +extern SDL_DECLSPEC SDL_GamepadBinding ** SDLCALL SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count); /** * Manually pump gamepad updates if not using the loop. diff --git a/include/SDL3/SDL_haptic.h b/include/SDL3/SDL_haptic.h index d288a86a35..1d0a54efee 100644 --- a/include/SDL3/SDL_haptic.h +++ b/include/SDL3/SDL_haptic.h @@ -942,7 +942,7 @@ typedef Uint32 SDL_HapticID; * * \sa SDL_OpenHaptic */ -extern SDL_DECLSPEC_FREE SDL_HapticID * SDLCALL SDL_GetHaptics(int *count); +extern SDL_DECLSPEC SDL_HapticID * SDLCALL SDL_GetHaptics(int *count); /** * Get the implementation dependent name of a haptic device. diff --git a/include/SDL3/SDL_joystick.h b/include/SDL3/SDL_joystick.h index 9713002772..1a1707664c 100644 --- a/include/SDL3/SDL_joystick.h +++ b/include/SDL3/SDL_joystick.h @@ -212,7 +212,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasJoystick(void); * \sa SDL_HasJoystick * \sa SDL_OpenJoystick */ -extern SDL_DECLSPEC_FREE SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count); +extern SDL_DECLSPEC SDL_JoystickID * SDLCALL SDL_GetJoysticks(int *count); /** * Get the implementation dependent name of a joystick. diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index 4c2569ecbb..b5453a0a15 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -84,7 +84,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasKeyboard(void); * \sa SDL_GetKeyboardNameForID * \sa SDL_HasKeyboard */ -extern SDL_DECLSPEC_FREE SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count); +extern SDL_DECLSPEC SDL_KeyboardID * SDLCALL SDL_GetKeyboards(int *count); /** * Get the name of a keyboard. diff --git a/include/SDL3/SDL_locale.h b/include/SDL3/SDL_locale.h index 121108bc7c..85d77500c4 100644 --- a/include/SDL3/SDL_locale.h +++ b/include/SDL3/SDL_locale.h @@ -98,7 +98,7 @@ typedef struct SDL_Locale * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE SDL_Locale ** SDLCALL SDL_GetPreferredLocales(int *count); +extern SDL_DECLSPEC SDL_Locale ** SDLCALL SDL_GetPreferredLocales(int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index 074cd9c1a1..185757aee9 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -146,7 +146,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasMouse(void); * \sa SDL_GetMouseNameForID * \sa SDL_HasMouse */ -extern SDL_DECLSPEC_FREE SDL_MouseID * SDLCALL SDL_GetMice(int *count); +extern SDL_DECLSPEC SDL_MouseID * SDLCALL SDL_GetMice(int *count); /** * Get the name of a mouse. diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index 83411d3e20..14e0750995 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -527,9 +527,9 @@ extern "C" { #define SDL_stack_free(data) SDL_free(data) #endif -extern SDL_DECLSPEC_FREE SDL_MALLOC void * SDLCALL SDL_malloc(size_t size); -extern SDL_DECLSPEC_FREE SDL_MALLOC SDL_ALLOC_SIZE2(1, 2) void * SDLCALL SDL_calloc(size_t nmemb, size_t size); -extern SDL_DECLSPEC_FREE SDL_ALLOC_SIZE(2) void * SDLCALL SDL_realloc(void *mem, size_t size); +extern SDL_DECLSPEC SDL_MALLOC void * SDLCALL SDL_malloc(size_t size); +extern SDL_DECLSPEC SDL_MALLOC SDL_ALLOC_SIZE2(1, 2) void * SDLCALL SDL_calloc(size_t nmemb, size_t size); +extern SDL_DECLSPEC SDL_ALLOC_SIZE(2) void * SDLCALL SDL_realloc(void *mem, size_t size); extern SDL_DECLSPEC void SDLCALL SDL_free(void *mem); typedef void *(SDLCALL *SDL_malloc_func)(size_t size); diff --git a/include/SDL3/SDL_storage.h b/include/SDL3/SDL_storage.h index 84a90f0e76..7fc58a887d 100644 --- a/include/SDL3/SDL_storage.h +++ b/include/SDL3/SDL_storage.h @@ -419,7 +419,7 @@ extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetStorageSpaceRemaining(SDL_Storage *sto * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE char ** SDLCALL SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count); +extern SDL_DECLSPEC char ** SDLCALL SDL_GlobStorageDirectory(SDL_Storage *storage, const char *path, const char *pattern, SDL_GlobFlags flags, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_touch.h b/include/SDL3/SDL_touch.h index d040680b56..6889f36972 100644 --- a/include/SDL3/SDL_touch.h +++ b/include/SDL3/SDL_touch.h @@ -91,7 +91,7 @@ typedef struct SDL_Finger * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE SDL_TouchID * SDLCALL SDL_GetTouchDevices(int *count); +extern SDL_DECLSPEC SDL_TouchID * SDLCALL SDL_GetTouchDevices(int *count); /** * Get the touch device name as reported from the driver. @@ -127,7 +127,7 @@ extern SDL_DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_Touch * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE SDL_Finger ** SDLCALL SDL_GetTouchFingers(SDL_TouchID touchID, int *count); +extern SDL_DECLSPEC SDL_Finger ** SDLCALL SDL_GetTouchFingers(SDL_TouchID touchID, int *count); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index f0b0d7755e..387f911404 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -395,7 +395,7 @@ extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count); +extern SDL_DECLSPEC SDL_DisplayID * SDLCALL SDL_GetDisplays(int *count); /** * Return the primary display. @@ -560,7 +560,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetDisplayContentScale(SDL_DisplayID displ * * \sa SDL_GetDisplays */ -extern SDL_DECLSPEC_FREE SDL_DisplayMode ** SDLCALL SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count); +extern SDL_DECLSPEC SDL_DisplayMode ** SDLCALL SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count); /** * Get the closest match to the requested display mode. @@ -770,7 +770,7 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode( * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size); +extern SDL_DECLSPEC void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size); /** * Get the pixel format associated with the window. @@ -796,7 +796,7 @@ extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetWindowPixelFormat(SDL_Window * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC_FREE SDL_Window ** SDLCALL SDL_GetWindows(int *count); +extern SDL_DECLSPEC SDL_Window ** SDLCALL SDL_GetWindows(int *count); /** * Create a window with the specified dimensions and flags. diff --git a/src/dynapi/gendynapi.py b/src/dynapi/gendynapi.py index 091ce0d5ce..fb601af9df 100755 --- a/src/dynapi/gendynapi.py +++ b/src/dynapi/gendynapi.py @@ -196,7 +196,6 @@ def main(): # func_ret = func_ret.replace('extern', ' ') func_ret = func_ret.replace('SDLCALL', ' ') - func_ret = func_ret.replace('SDL_DECLSPEC_FREE', ' ') func_ret = func_ret.replace('SDL_DECLSPEC', ' ') # Remove trailing spaces in front of '*' tmp = ""