Made the cursor list check a compile time assert instead of a runtime one

This will catch this being out of date more quickly in the future
main
Sam Lantinga 2023-12-26 09:57:11 -08:00
parent d6fb0d91d8
commit 74418e1aa8
1 changed files with 2 additions and 2 deletions

View File

@ -43,6 +43,8 @@ static const char *cursorNames[] = {
"window bottom left", "window bottom left",
"window left" "window left"
}; };
SDL_COMPILE_TIME_ASSERT(cursorNames, SDL_arraysize(cursorNames) == SDL_NUM_SYSTEM_CURSORS);
static int system_cursor = -1; static int system_cursor = -1;
static SDL_Cursor *cursor = NULL; static SDL_Cursor *cursor = NULL;
static SDL_bool relative_mode = SDL_FALSE; static SDL_bool relative_mode = SDL_FALSE;
@ -266,8 +268,6 @@ int main(int argc, char *argv[])
/* Enable standard application logging */ /* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
SDL_assert(SDL_arraysize(cursorNames) == SDL_NUM_SYSTEM_CURSORS);
if (!SDLTest_CommonDefaultArgs(state, argc, argv) || !SDLTest_CommonInit(state)) { if (!SDLTest_CommonDefaultArgs(state, argc, argv) || !SDLTest_CommonInit(state)) {
SDLTest_CommonQuit(state); SDLTest_CommonQuit(state);
return 1; return 1;