dynapi: Minor optimization to SDL_SetError wrapper.

This commit is contained in:
Ryan C. Gordon 2024-12-11 18:04:43 -05:00
parent a1e8d5c327
commit 6fe09e3aa4
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
1 changed files with 4 additions and 7 deletions

View File

@ -86,13 +86,10 @@ static void SDL_InitDynamicAPI(void);
result = jump_table.SDL_vsnprintf(buf, sizeof(buf), fmt, ap); \
va_end(ap); \
if (result >= 0 && (size_t)result >= sizeof(buf)) { \
size_t len = (size_t)result + 1; \
str = (char *)jump_table.SDL_malloc(len); \
if (str) { \
va_start(ap, fmt); \
result = jump_table.SDL_vsnprintf(str, len, fmt, ap); \
va_end(ap); \
} \
str = NULL; \
va_start(ap, fmt); \
result = jump_table.SDL_vasprintf(&str, fmt, ap); \
va_end(ap); \
} \
if (result >= 0) { \
jump_table.SDL_SetError("%s", str); \