Update for SDL3 coding style (#6717)

I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.

In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.

The script I ran for the src directory is added as build-scripts/clang-format-src.sh

This fixes:
#6592
#6593
#6594
This commit is contained in:
Sam Lantinga 2022-11-30 12:51:59 -08:00 committed by GitHub
parent 14b902faca
commit 5750bcb174
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
781 changed files with 51659 additions and 55763 deletions

View file

@ -24,8 +24,7 @@
#include "SDL_error_c.h"
int
SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
int SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
/* Ignore call if invalid format pointer was passed */
if (fmt != NULL) {
@ -33,7 +32,7 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
int result;
SDL_error *error = SDL_GetErrBuf();
error->error = 1; /* mark error as valid */
error->error = 1; /* mark error as valid */
va_start(ap, fmt);
result = SDL_vsnprintf(error->str, error->len, fmt, ap);
@ -51,7 +50,6 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
}
}
if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) {
/* If we are in debug mode, print out the error message */
SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", error->str);
@ -69,15 +67,13 @@ SDL_GetError(void)
return error->error ? error->str : "";
}
void
SDL_ClearError(void)
void SDL_ClearError(void)
{
SDL_GetErrBuf()->error = 0;
}
/* Very common errors go here */
int
SDL_Error(SDL_errorcode code)
int SDL_Error(SDL_errorcode code)
{
switch (code) {
case SDL_ENOMEM:
@ -96,8 +92,7 @@ SDL_Error(SDL_errorcode code)
}
#ifdef TEST_ERROR
int
main(int argc, char *argv[])
int main(int argc, char *argv[])
{
char buffer[BUFSIZ + 1];
@ -112,7 +107,6 @@ main(int argc, char *argv[])
}
#endif
char *
SDL_GetErrorMsg(char *errstr, int maxlen)
{