mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-15 22:35:59 +00:00
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:
@@ -29,17 +29,15 @@ extern "C" {
|
||||
#include "SDL_sysmutex_c.h"
|
||||
#include <Windows.h>
|
||||
|
||||
|
||||
/* Create a mutex */
|
||||
extern "C"
|
||||
SDL_mutex *
|
||||
extern "C" SDL_mutex *
|
||||
SDL_CreateMutex(void)
|
||||
{
|
||||
/* Allocate and initialize the mutex */
|
||||
try {
|
||||
SDL_mutex * mutex = new SDL_mutex;
|
||||
SDL_mutex *mutex = new SDL_mutex;
|
||||
return mutex;
|
||||
} catch (std::system_error & ex) {
|
||||
} catch (std::system_error &ex) {
|
||||
SDL_SetError("unable to create a C++ mutex: code=%d; %s", ex.code(), ex.what());
|
||||
return NULL;
|
||||
} catch (std::bad_alloc &) {
|
||||
@@ -49,9 +47,8 @@ SDL_CreateMutex(void)
|
||||
}
|
||||
|
||||
/* Free the mutex */
|
||||
extern "C"
|
||||
void
|
||||
SDL_DestroyMutex(SDL_mutex * mutex)
|
||||
extern "C" void
|
||||
SDL_DestroyMutex(SDL_mutex *mutex)
|
||||
{
|
||||
if (mutex != NULL) {
|
||||
delete mutex;
|
||||
@@ -59,9 +56,8 @@ SDL_DestroyMutex(SDL_mutex * mutex)
|
||||
}
|
||||
|
||||
/* Lock the semaphore */
|
||||
extern "C"
|
||||
int
|
||||
SDL_mutexP(SDL_mutex * mutex)
|
||||
extern "C" int
|
||||
SDL_mutexP(SDL_mutex *mutex)
|
||||
{
|
||||
if (mutex == NULL) {
|
||||
return SDL_InvalidParamError("mutex");
|
||||
@@ -70,14 +66,13 @@ SDL_mutexP(SDL_mutex * mutex)
|
||||
try {
|
||||
mutex->cpp_mutex.lock();
|
||||
return 0;
|
||||
} catch (std::system_error & ex) {
|
||||
} catch (std::system_error &ex) {
|
||||
return SDL_SetError("unable to lock a C++ mutex: code=%d; %s", ex.code(), ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
/* TryLock the mutex */
|
||||
int
|
||||
SDL_TryLockMutex(SDL_mutex * mutex)
|
||||
int SDL_TryLockMutex(SDL_mutex *mutex)
|
||||
{
|
||||
int retval = 0;
|
||||
if (mutex == NULL) {
|
||||
@@ -91,9 +86,8 @@ SDL_TryLockMutex(SDL_mutex * mutex)
|
||||
}
|
||||
|
||||
/* Unlock the mutex */
|
||||
extern "C"
|
||||
int
|
||||
SDL_mutexV(SDL_mutex * mutex)
|
||||
extern "C" int
|
||||
SDL_mutexV(SDL_mutex *mutex)
|
||||
{
|
||||
if (mutex == NULL) {
|
||||
return SDL_InvalidParamError("mutex");
|
||||
|
Reference in New Issue
Block a user