Skip to content

Commit

Permalink
makeTmpString
Browse files Browse the repository at this point in the history
Signed-off-by: James Cherry <[email protected]>
  • Loading branch information
jjcherry56 committed Nov 10, 2024
1 parent fba5a77 commit 3166392
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions util/StringUtil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3166392

Please sign in to comment.