mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-12-03 17:42:40 +00:00
clean up the buffer size calcs a bit
This commit is contained in:
parent
3909176957
commit
ad4f29c6a8
1 changed files with 3 additions and 3 deletions
|
@ -179,9 +179,9 @@ C_Print (const char *fmt, va_list args)
|
|||
int size;
|
||||
static int buffer_size;
|
||||
|
||||
size = vsnprintf (buffer, buffer_size, fmt, args);
|
||||
if (size + 1 > buffer_size) {
|
||||
buffer_size = ((size + 1 + 1024) / 1024) * 1024; // 1k multiples
|
||||
size = vsnprintf (buffer, buffer_size, fmt, args) + 1; // +1 for nul
|
||||
if (size > buffer_size) {
|
||||
buffer_size = (size + 1023) & ~1023; // 1k multiples
|
||||
buffer = realloc (buffer, buffer_size);
|
||||
if (!buffer)
|
||||
Sys_Error ("console: could not allocate %d bytes\n",
|
||||
|
|
Loading…
Reference in a new issue