Code style: changed "sizeof foo" to "sizeof(foo)" (thanks @sezero!)
This commit is contained in:
@@ -75,7 +75,7 @@ TestRealWorld(int init_sem)
|
||||
/* Create all the threads */
|
||||
for (i = 0; i < NUM_THREADS; ++i) {
|
||||
char name[64];
|
||||
(void)SDL_snprintf(name, sizeof name, "Thread%u", (unsigned int)i);
|
||||
(void)SDL_snprintf(name, sizeof(name), "Thread%u", (unsigned int)i);
|
||||
thread_states[i].number = i;
|
||||
thread_states[i].thread = SDL_CreateThread(ThreadFuncRealWorld, name, (void *)&thread_states[i]);
|
||||
}
|
||||
@@ -197,7 +197,7 @@ TestOverheadContended(SDL_bool try_wait)
|
||||
/* Create multiple threads to starve the semaphore and cause contention */
|
||||
for (i = 0; i < NUM_THREADS; ++i) {
|
||||
char name[64];
|
||||
(void)SDL_snprintf(name, sizeof name, "Thread%u", (unsigned int)i);
|
||||
(void)SDL_snprintf(name, sizeof(name), "Thread%u", (unsigned int)i);
|
||||
thread_states[i].flag = try_wait;
|
||||
thread_states[i].thread = SDL_CreateThread(ThreadFuncOverheadContended, name, (void *)&thread_states[i]);
|
||||
}
|
||||
@@ -230,17 +230,17 @@ TestOverheadContended(SDL_bool try_wait)
|
||||
duration, try_wait ? "where contended" : "timed out", content_count,
|
||||
loop_count, ((float)content_count * 100) / loop_count);
|
||||
/* Print how many semaphores where consumed per thread */
|
||||
(void)SDL_snprintf(textBuffer, sizeof textBuffer, "{ ");
|
||||
(void)SDL_snprintf(textBuffer, sizeof(textBuffer), "{ ");
|
||||
for (i = 0; i < NUM_THREADS; ++i) {
|
||||
if (i > 0) {
|
||||
len = SDL_strlen(textBuffer);
|
||||
(void)SDL_snprintf(textBuffer + len, sizeof textBuffer - len, ", ");
|
||||
(void)SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, ", ");
|
||||
}
|
||||
len = SDL_strlen(textBuffer);
|
||||
(void)SDL_snprintf(textBuffer + len, sizeof textBuffer - len, "%d", thread_states[i].loop_count - thread_states[i].content_count);
|
||||
(void)SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, "%d", thread_states[i].loop_count - thread_states[i].content_count);
|
||||
}
|
||||
len = SDL_strlen(textBuffer);
|
||||
(void)SDL_snprintf(textBuffer + len, sizeof textBuffer - len, " }\n");
|
||||
(void)SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, " }\n");
|
||||
SDL_Log("%s\n", textBuffer);
|
||||
|
||||
SDL_DestroySemaphore(sem);
|
||||
|
||||
Reference in New Issue
Block a user