Code style: changed "sizeof foo" to "sizeof(foo)" (thanks @sezero!)

(cherry picked from commit c6443d86c9)
This commit is contained in:
Sam Lantinga committed 2023-03-09 15:23:59 -08:00
1 parent 46d143376a
commit 0d76380042
71 files changed
+525 -234

No files matched your search

+6 -6
View File
@@ -76,7 +76,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]);
}
@@ -198,7 +198,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]);
}
@@ -231,17 +231,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);