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_list args;
va_start(args, fmt); va_start(args, fmt);
char *result; char *result = nullptr;
if (vasprintf(&result, fmt, args) == -1) if (vasprintf(&result, fmt, args) == -1)
criticalError(267, "out of memory"); criticalError(267, "out of memory");
stream << result; stream << result;

View File

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