gcc warning

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2021-12-09 18:02:37 -07:00
parent fac2914668
commit d138fc1a15
2 changed files with 8 additions and 3 deletions

View File

@ -1621,7 +1621,7 @@ streamPrint(ofstream &stream,
{
va_list args;
va_start(args, fmt);
char *result;
char *result = nullptr;
if (vasprintf(&result, fmt, args) == -1)
criticalError(267, "out of memory");
stream << result;

View File

@ -18,7 +18,10 @@ namespace sta {
// Windows returns -1 if the string does not fit rather than the
// required string length as the standard specifies.
int
vsnprint(char *str, size_t size, const char *fmt, va_list args)
vsnprint(char *str,
size_t size,
const char *fmt,
va_list args)
{
// Copy args before using them because consumption is destructive.
va_list args_copy1;
@ -37,7 +40,9 @@ vsnprint(char *str, size_t size, const char *fmt, va_list args)
}
int
vasprintf(char **str, const char *fmt, va_list args)
vasprintf(char **str,
const char *fmt,
va_list args)
{
size_t size = 1024;
for (;;) {