Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
#include "SDL_internal.h"
|
||||
|
||||
/* An implementation of condition variables using semaphores and mutexes */
|
||||
// An implementation of condition variables using semaphores and mutexes
|
||||
/*
|
||||
This implementation borrows heavily from the BeOS condition variable
|
||||
implementation, written by Christopher Tate and Owen Smith. Thanks!
|
||||
@@ -49,7 +49,7 @@ typedef struct SDL_cond_generic
|
||||
SDL_Semaphore *wait_done;
|
||||
} SDL_cond_generic;
|
||||
|
||||
/* Create a condition variable */
|
||||
// Create a condition variable
|
||||
SDL_Condition *SDL_CreateCondition_generic(void)
|
||||
{
|
||||
SDL_cond_generic *cond = (SDL_cond_generic *)SDL_calloc(1, sizeof(*cond));
|
||||
@@ -70,7 +70,7 @@ SDL_Condition *SDL_CreateCondition_generic(void)
|
||||
return (SDL_Condition *)cond;
|
||||
}
|
||||
|
||||
/* Destroy a condition variable */
|
||||
// Destroy a condition variable
|
||||
void SDL_DestroyCondition_generic(SDL_Condition *_cond)
|
||||
{
|
||||
SDL_cond_generic *cond = (SDL_cond_generic *)_cond;
|
||||
@@ -88,7 +88,7 @@ void SDL_DestroyCondition_generic(SDL_Condition *_cond)
|
||||
}
|
||||
}
|
||||
|
||||
/* Restart one of the threads that are waiting on the condition variable */
|
||||
// Restart one of the threads that are waiting on the condition variable
|
||||
int SDL_SignalCondition_generic(SDL_Condition *_cond)
|
||||
{
|
||||
SDL_cond_generic *cond = (SDL_cond_generic *)_cond;
|
||||
@@ -114,7 +114,7 @@ int SDL_SignalCondition_generic(SDL_Condition *_cond)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Restart all threads that are waiting on the condition variable */
|
||||
// Restart all threads that are waiting on the condition variable
|
||||
int SDL_BroadcastCondition_generic(SDL_Condition *_cond)
|
||||
{
|
||||
SDL_cond_generic *cond = (SDL_cond_generic *)_cond;
|
||||
@@ -189,10 +189,10 @@ int SDL_WaitConditionTimeoutNS_generic(SDL_Condition *_cond, SDL_Mutex *mutex, S
|
||||
++cond->waiting;
|
||||
SDL_UnlockMutex(cond->lock);
|
||||
|
||||
/* Unlock the mutex, as is required by condition variable semantics */
|
||||
// Unlock the mutex, as is required by condition variable semantics
|
||||
SDL_UnlockMutex(mutex);
|
||||
|
||||
/* Wait for a signal */
|
||||
// Wait for a signal
|
||||
retval = SDL_WaitSemaphoreTimeoutNS(cond->wait_sem, timeoutNS);
|
||||
|
||||
/* Let the signaler know we have completed the wait, otherwise
|
||||
@@ -203,20 +203,20 @@ int SDL_WaitConditionTimeoutNS_generic(SDL_Condition *_cond, SDL_Mutex *mutex, S
|
||||
*/
|
||||
SDL_LockMutex(cond->lock);
|
||||
if (cond->signals > 0) {
|
||||
/* If we timed out, we need to eat a condition signal */
|
||||
// If we timed out, we need to eat a condition signal
|
||||
if (retval > 0) {
|
||||
SDL_WaitSemaphore(cond->wait_sem);
|
||||
}
|
||||
/* We always notify the signal thread that we are done */
|
||||
// We always notify the signal thread that we are done
|
||||
SDL_SignalSemaphore(cond->wait_done);
|
||||
|
||||
/* Signal handshake complete */
|
||||
// Signal handshake complete
|
||||
--cond->signals;
|
||||
}
|
||||
--cond->waiting;
|
||||
SDL_UnlockMutex(cond->lock);
|
||||
|
||||
/* Lock the mutex, as is required by condition variable semantics */
|
||||
// Lock the mutex, as is required by condition variable semantics
|
||||
SDL_LockMutex(mutex);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,6 +31,6 @@ int SDL_SignalCondition_generic(SDL_Condition *cond);
|
||||
int SDL_BroadcastCondition_generic(SDL_Condition *cond);
|
||||
int SDL_WaitConditionTimeoutNS_generic(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS);
|
||||
|
||||
#endif /* SDL_THREAD_GENERIC_COND_SUFFIX */
|
||||
#endif // SDL_THREAD_GENERIC_COND_SUFFIX
|
||||
|
||||
#endif /* SDL_syscond_generic_h_ */
|
||||
#endif // SDL_syscond_generic_h_
|
||||
|
||||
@@ -37,7 +37,7 @@ SDL_Mutex *SDL_CreateMutex(void)
|
||||
|
||||
#ifndef SDL_THREADS_DISABLED
|
||||
if (mutex) {
|
||||
/* Create the mutex semaphore, with initial value 1 */
|
||||
// Create the mutex semaphore, with initial value 1
|
||||
mutex->sem = SDL_CreateSemaphore(1);
|
||||
mutex->recursive = 0;
|
||||
mutex->owner = 0;
|
||||
@@ -78,7 +78,7 @@ void SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS // clang doe
|
||||
mutex->recursive = 0;
|
||||
}
|
||||
}
|
||||
#endif /* SDL_THREADS_DISABLED */
|
||||
#endif // SDL_THREADS_DISABLED
|
||||
}
|
||||
|
||||
int SDL_TryLockMutex(SDL_Mutex *mutex)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
#include "SDL_internal.h"
|
||||
|
||||
/* An implementation of semaphores using mutexes and condition variables */
|
||||
// An implementation of semaphores using mutexes and condition variables
|
||||
|
||||
#include "SDL_systhread_c.h"
|
||||
|
||||
@@ -111,7 +111,7 @@ int SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
|
||||
return SDL_InvalidParamError("sem");
|
||||
}
|
||||
|
||||
/* A timeout of 0 is an easy case */
|
||||
// A timeout of 0 is an easy case
|
||||
if (timeoutNS == 0) {
|
||||
retval = SDL_MUTEX_TIMEDOUT;
|
||||
SDL_LockMutex(sem->count_lock);
|
||||
@@ -169,4 +169,4 @@ int SDL_SignalSemaphore(SDL_Semaphore *sem)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* SDL_THREADS_DISABLED */
|
||||
#endif // SDL_THREADS_DISABLED
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
#include "SDL_internal.h"
|
||||
|
||||
/* Thread management routines for SDL */
|
||||
// Thread management routines for SDL
|
||||
|
||||
#include "../SDL_systhread.h"
|
||||
|
||||
|
||||
@@ -20,5 +20,5 @@
|
||||
*/
|
||||
#include "SDL_internal.h"
|
||||
|
||||
/* Stub until we implement threads on this platform */
|
||||
// Stub until we implement threads on this platform
|
||||
typedef int SYS_ThreadHandle;
|
||||
|
||||
Reference in New Issue
Block a user