mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-12-21 04:35:23 +08:00
Cleanup add brace (#6545)
* Add braces after if conditions
* More add braces after if conditions
* Add braces after while() conditions
* Fix compilation because of macro being modified
* Add braces to for loop
* Add braces after if/goto
* Move comments up
* Remove extra () in the 'return ...;' statements
* More remove extra () in the 'return ...;' statements
* More remove extra () in the 'return ...;' statements after merge
* Fix inconsistent patterns are xxx == NULL vs !xxx
* More "{}" for "if() break;" and "if() continue;"
* More "{}" after if() short statement
* More "{}" after "if () return;" statement
* More fix inconsistent patterns are xxx == NULL vs !xxx
* Revert some modificaion on SDL_RLEaccel.c
* SDL_RLEaccel: no short statement
* Cleanup 'if' where the bracket is in a new line
* Cleanup 'while' where the bracket is in a new line
* Cleanup 'for' where the bracket is in a new line
* Cleanup 'else' where the bracket is in a new line
This commit is contained in:
@@ -115,8 +115,9 @@ TestWaitTimeout(void)
|
||||
SDL_Log("Wait took %" SDL_PRIu32 " milliseconds\n\n", duration);
|
||||
|
||||
/* Check to make sure the return value indicates timed out */
|
||||
if (retval != SDL_MUTEX_TIMEDOUT)
|
||||
if (retval != SDL_MUTEX_TIMEDOUT) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_SemWaitTimeout returned: %d; expected: %d\n\n", retval, SDL_MUTEX_TIMEDOUT);
|
||||
}
|
||||
|
||||
SDL_DestroySemaphore(sem);
|
||||
}
|
||||
@@ -133,7 +134,7 @@ TestOverheadUncontended(void)
|
||||
SDL_Log("Doing %d uncontended Post/Wait operations on semaphore\n", NUM_OVERHEAD_OPS * NUM_OVERHEAD_OPS_MULT);
|
||||
|
||||
start_ticks = SDL_GetTicks();
|
||||
for (i = 0; i < NUM_OVERHEAD_OPS_MULT; i++){
|
||||
for (i = 0; i < NUM_OVERHEAD_OPS_MULT; i++) {
|
||||
for (j = 0; j < NUM_OVERHEAD_OPS; j++) {
|
||||
SDL_SemPost(sem);
|
||||
}
|
||||
@@ -155,14 +156,14 @@ ThreadFuncOverheadContended(void *data)
|
||||
Thread_State *state = (Thread_State *) data;
|
||||
|
||||
if (state->flag) {
|
||||
while(alive) {
|
||||
while (alive) {
|
||||
if (SDL_SemTryWait(sem) == SDL_MUTEX_TIMEDOUT) {
|
||||
++state->content_count;
|
||||
}
|
||||
++state->loop_count;
|
||||
}
|
||||
} else {
|
||||
while(alive) {
|
||||
while (alive) {
|
||||
/* Timeout needed to allow check on alive flag */
|
||||
if (SDL_SemWaitTimeout(sem, 50) == SDL_MUTEX_TIMEDOUT) {
|
||||
++state->content_count;
|
||||
@@ -249,13 +250,13 @@ main(int argc, char **argv)
|
||||
|
||||
if (argc < 2) {
|
||||
SDL_Log("Usage: %s init_value\n", argv[0]);
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Load the SDL library */
|
||||
if (SDL_Init(0) < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
signal(SIGTERM, killed);
|
||||
signal(SIGINT, killed);
|
||||
@@ -274,7 +275,7 @@ main(int argc, char **argv)
|
||||
TestOverheadContended(SDL_TRUE);
|
||||
|
||||
SDL_Quit();
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
Reference in New Issue
Block a user