makeTmpString

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2024-11-09 20:42:26 -08:00
parent fba5a77d26
commit 3166392242
1 changed files with 6 additions and 2 deletions

View File

@ -20,12 +20,15 @@
#include <cctype>
#include <cstdio>
#include <array>
#include <algorithm>
#include "Machine.hh"
#include "Mutex.hh"
namespace sta {
using std::max;
static void
stringPrintTmp(const char *fmt,
va_list args,
@ -199,9 +202,10 @@ makeTmpString(size_t length)
if (tmp_length < length) {
// String isn't long enough. Make a new one.
delete [] tmp_str;
tmp_str = new char[length];
tmp_length = max(tmp_string_initial_length, length);
tmp_str = new char[tmp_length];
tmp_strings[tmp_string_next] = tmp_str;
tmp_string_lengths[tmp_string_next] = length;
tmp_string_lengths[tmp_string_next] = tmp_length;
}
tmp_string_next++;
return tmp_str;