Prefer SDL_arraysize()

Replace uses of (sizeof(arr)/sizeof(arr[0]), and similar,
with the SDL_arraysize() macro.
This commit is contained in:
Eddy Jansson
2025-12-30 20:59:46 +01:00
committed by Sam Lantinga
parent d33642b710
commit 3d354eeaad
10 changed files with 17 additions and 17 deletions

View File

@@ -36,7 +36,7 @@ void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
{
WCHAR str[80]; // Per the docs, the time and short date format strings can be a max of 80 characters.
if (df && GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, str, sizeof(str) / sizeof(WCHAR))) {
if (df && GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, str, SDL_arraysize(str))) {
LPWSTR s = str;
while (*s) {
switch (*s++) {
@@ -58,7 +58,7 @@ void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
found_date:
// Figure out the preferred system date format.
if (tf && GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, str, sizeof(str) / sizeof(WCHAR))) {
if (tf && GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, str, SDL_arraysize(str))) {
LPWSTR s = str;
while (*s) {
switch (*s++) {