diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index 997c8efef..feae18302 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -3113,3 +3113,13 @@ typedef SDL_RWops, SDL_IOStream; @@ - SDL_RWops + SDL_IOStream +@@ +@@ +- SDL_LogGetOutputFunction ++ SDL_GetLogOutputFunction + (...) +@@ +@@ +- SDL_LogSetOutputFunction ++ SDL_SetLogOutputFunction + (...) diff --git a/docs/README-migration.md b/docs/README-migration.md index f611b2485..4576c7d64 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -888,6 +888,12 @@ The following symbols have been renamed: SDL_LoadFunction() now returns `SDL_FunctionPointer` instead of `void *`, and should be cast to the appropriate function type. You can define SDL_FUNCTION_POINTER_IS_VOID_POINTER in your project to restore the previous behavior. +## SDL_log.h + +The following functions have been renamed: +* SDL_LogGetOutputFunction() => SDL_GetLogOutputFunction() +* SDL_LogSetOutputFunction() => SDL_SetLogOutputFunction() + ## SDL_main.h SDL3 doesn't have a static libSDLmain to link against anymore. diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 4e95fa341..c0cc74ba6 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -454,7 +454,7 @@ extern "C" { * "1" - Log most events (other than the really spammy ones). * "2" - Include mouse and finger motion events. * - * This is generally meant to be used to debug SDL itself, but can be useful for application developers that need better visibility into what is going on in the event queue. Logged events are sent through SDL_Log(), which means by default they appear on stdout on most platforms or maybe OutputDebugString() on Windows, and can be funneled by the app with SDL_LogSetOutputFunction(), etc. + * This is generally meant to be used to debug SDL itself, but can be useful for application developers that need better visibility into what is going on in the event queue. Logged events are sent through SDL_Log(), which means by default they appear on stdout on most platforms or maybe OutputDebugString() on Windows, and can be funneled by the app with SDL_SetLogOutputFunction(), etc. * * This hint can be set anytime. */ diff --git a/include/SDL3/SDL_log.h b/include/SDL3/SDL_log.h index 4bed8f423..99d2f2c36 100644 --- a/include/SDL3/SDL_log.h +++ b/include/SDL3/SDL_log.h @@ -360,7 +360,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, * * This function is called by SDL when there is new text to be logged. * - * \param userdata what was passed as `userdata` to SDL_LogSetOutputFunction() + * \param userdata what was passed as `userdata` to SDL_SetLogOutputFunction() * \param category the category of the message * \param priority the priority of the message * \param message the message being output @@ -377,9 +377,9 @@ typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_ * * \since This function is available since SDL 3.0.0. * - * \sa SDL_LogSetOutputFunction + * \sa SDL_SetLogOutputFunction */ -extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata); +extern DECLSPEC void SDLCALL SDL_GetLogOutputFunction(SDL_LogOutputFunction *callback, void **userdata); /** * Replace the default log output function with one of your own. @@ -389,9 +389,9 @@ extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *cal * * \since This function is available since SDL 3.0.0. * - * \sa SDL_LogGetOutputFunction + * \sa SDL_GetLogOutputFunction */ -extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata); +extern DECLSPEC void SDLCALL SDL_SetLogOutputFunction(SDL_LogOutputFunction callback, void *userdata); /* Ends C function definitions when using C++ */ diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h index a6b0f5bf3..98353aa6a 100644 --- a/include/SDL3/SDL_oldnames.h +++ b/include/SDL3/SDL_oldnames.h @@ -361,6 +361,10 @@ #define KMOD_SCROLL SDL_KMOD_SCROLL #define KMOD_SHIFT SDL_KMOD_SHIFT +/* ##SDL_log.h */ +#define SDL_LogGetOutputFunction SDL_GetLogOutputFunction +#define SDL_LogSetOutputFunction SDL_SetLogOutputFunction + /* ##SDL_mouse.h */ #define SDL_FreeCursor SDL_DestroyCursor @@ -858,6 +862,10 @@ #define KMOD_SCROLL KMOD_SCROLL_renamed_SDL_KMOD_SCROLL #define KMOD_SHIFT KMOD_SHIFT_renamed_SDL_KMOD_SHIFT +/* ##SDL_log.h */ +#define SDL_LogGetOutputFunction SDL_LogGetOutputFunction_renamed_SDL_GetLogOutputFunction +#define SDL_LogSetOutputFunction SDL_LogSetOutputFunction_renamed_SDL_SetLogOutputFunction + /* ##SDL_mouse.h */ #define SDL_FreeCursor SDL_FreeCursor_renamed_SDL_DestroyCursor diff --git a/src/SDL_log.c b/src/SDL_log.c index 1dc706618..2baf16a0f 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -594,7 +594,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority #endif } -void SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata) +void SDL_GetLogOutputFunction(SDL_LogOutputFunction *callback, void **userdata) { if (callback) { *callback = SDL_log_function; @@ -604,7 +604,7 @@ void SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata) } } -void SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata) +void SDL_SetLogOutputFunction(SDL_LogOutputFunction callback, void *userdata) { SDL_log_function = callback; SDL_log_userdata = userdata; diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index eec9befc0..7adf424b5 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -423,14 +423,14 @@ SDL3_0.0.0 { SDL_LogCritical; SDL_LogDebug; SDL_LogError; - SDL_LogGetOutputFunction; + SDL_GetLogOutputFunction; SDL_LogGetPriority; SDL_LogInfo; SDL_LogMessage; SDL_LogMessageV; SDL_LogResetPriorities; SDL_LogSetAllPriority; - SDL_LogSetOutputFunction; + SDL_SetLogOutputFunction; SDL_LogSetPriority; SDL_LogVerbose; SDL_LogWarn; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 8c0fd4b7e..40bef31e0 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -447,14 +447,14 @@ #define SDL_LogCritical SDL_LogCritical_REAL #define SDL_LogDebug SDL_LogDebug_REAL #define SDL_LogError SDL_LogError_REAL -#define SDL_LogGetOutputFunction SDL_LogGetOutputFunction_REAL +#define SDL_GetLogOutputFunction SDL_GetLogOutputFunction_REAL #define SDL_LogGetPriority SDL_LogGetPriority_REAL #define SDL_LogInfo SDL_LogInfo_REAL #define SDL_LogMessage SDL_LogMessage_REAL #define SDL_LogMessageV SDL_LogMessageV_REAL #define SDL_LogResetPriorities SDL_LogResetPriorities_REAL #define SDL_LogSetAllPriority SDL_LogSetAllPriority_REAL -#define SDL_LogSetOutputFunction SDL_LogSetOutputFunction_REAL +#define SDL_SetLogOutputFunction SDL_SetLogOutputFunction_REAL #define SDL_LogSetPriority SDL_LogSetPriority_REAL #define SDL_LogVerbose SDL_LogVerbose_REAL #define SDL_LogWarn SDL_LogWarn_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index c9880ef5f..6f7d95757 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -497,12 +497,12 @@ SDL_DYNAPI_PROC(void,SDL_LockRWLockForWriting,(SDL_RWLock *a),(a),) SDL_DYNAPI_PROC(int,SDL_LockSurface,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(int,SDL_LockTexture,(SDL_Texture *a, const SDL_Rect *b, void **c, int *d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_LockTextureToSurface,(SDL_Texture *a, const SDL_Rect *b, SDL_Surface **c),(a,b,c),return) -SDL_DYNAPI_PROC(void,SDL_LogGetOutputFunction,(SDL_LogOutputFunction *a, void **b),(a,b),) +SDL_DYNAPI_PROC(void,SDL_GetLogOutputFunction,(SDL_LogOutputFunction *a, void **b),(a,b),) SDL_DYNAPI_PROC(SDL_LogPriority,SDL_LogGetPriority,(int a),(a),return) SDL_DYNAPI_PROC(void,SDL_LogMessageV,(int a, SDL_LogPriority b, SDL_PRINTF_FORMAT_STRING const char *c, va_list d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_LogResetPriorities,(void),(),) SDL_DYNAPI_PROC(void,SDL_LogSetAllPriority,(SDL_LogPriority a),(a),) -SDL_DYNAPI_PROC(void,SDL_LogSetOutputFunction,(SDL_LogOutputFunction a, void *b),(a,b),) +SDL_DYNAPI_PROC(void,SDL_SetLogOutputFunction,(SDL_LogOutputFunction a, void *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogSetPriority,(int a, SDL_LogPriority b),(a,b),) SDL_DYNAPI_PROC(Uint32,SDL_MapRGB,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) SDL_DYNAPI_PROC(Uint32,SDL_MapRGBA,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return) diff --git a/test/testautomation_log.c b/test/testautomation_log.c index cfb76e4d4..b2024dc96 100644 --- a/test/testautomation_log.c +++ b/test/testautomation_log.c @@ -17,13 +17,13 @@ static void SDLCALL TestLogOutput(void *userdata, int category, SDL_LogPriority static void EnableTestLog(int *message_count) { *message_count = 0; - SDL_LogGetOutputFunction(&original_function, &original_userdata); - SDL_LogSetOutputFunction(TestLogOutput, message_count); + SDL_GetLogOutputFunction(&original_function, &original_userdata); + SDL_SetLogOutputFunction(TestLogOutput, message_count); } static void DisableTestLog() { - SDL_LogSetOutputFunction(original_function, original_userdata); + SDL_SetLogOutputFunction(original_function, original_userdata); } /* Fixture */