Augment the chances LogOutOfMem() works in out-of-memory conditions.

All instances are called with only one constant string so no need for
varargs dance.
This commit is contained in:
matthieu 2016-10-23 20:35:44 +00:00
parent d3274fece8
commit 7161f1690d
2 changed files with 5 additions and 9 deletions

View File

@ -39,7 +39,7 @@ extern void InitErrorLog (void);
extern void LogAppend (const char * fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
extern void LogError (const char * fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
extern void LogInfo (const char * fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
extern void LogOutOfMem (const char * fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
extern void LogOutOfMem (const char * function);
extern __dead void LogPanic (const char * fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);

View File

@ -98,15 +98,11 @@ LogPanic (const char * fmt, ...)
}
void
LogOutOfMem (const char * fmt, ...)
LogOutOfMem (const char *function)
{
fprintf (stderr, "xdm: out of memory in routine ");
{
va_list args;
va_start(args, fmt);
vfprintf (stderr, fmt, args);
va_end(args);
}
fputs("xdm: out of memory in routine ", stderr);
fputs(function, stderr);
fputc('\n', stderr);
fflush (stderr);
}