log: Allow log messages of any length.
Log messages are no longer truncated to SDL_MAX_LOG_MESSAGE.main
parent
645db217a0
commit
888899244c
|
@ -320,11 +320,12 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list
|
||||||
|
|
||||||
/* If message truncated, allocate and re-render */
|
/* If message truncated, allocate and re-render */
|
||||||
if (len >= sizeof(stack_buf)) {
|
if (len >= sizeof(stack_buf)) {
|
||||||
message = (char *)SDL_malloc(SDL_MAX_LOG_MESSAGE);
|
/* Allocate exactly what we need, including the zero-terminator */
|
||||||
|
message = (char *)SDL_malloc(len + 1);
|
||||||
if (!message)
|
if (!message)
|
||||||
return;
|
return;
|
||||||
va_copy(aq, ap);
|
va_copy(aq, ap);
|
||||||
len = SDL_vsnprintf(message, SDL_MAX_LOG_MESSAGE, fmt, aq);
|
len = SDL_vsnprintf(message, len + 1, fmt, aq);
|
||||||
va_end(aq);
|
va_end(aq);
|
||||||
} else {
|
} else {
|
||||||
message = stack_buf;
|
message = stack_buf;
|
||||||
|
|
Loading…
Reference in New Issue