mirror of
https://github.com/verilator/verilator.git
synced 2026-09-03 08:24:31 +02:00
Remove simple use of static data from V3OutFormatter::indentSpaces
This commit is contained in:
+3
-11
@@ -623,17 +623,9 @@ V3OutFormatter::V3OutFormatter(const string& filename, V3OutFormatter::Language
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
string V3OutFormatter::indentSpaces(int num) {
|
||||
// Indent the specified number of spaces. Use spaces.
|
||||
static char str[MAXSPACE + 20];
|
||||
char* cp = str;
|
||||
if (num > MAXSPACE) num = MAXSPACE;
|
||||
while (num > 0) {
|
||||
*cp++ = ' ';
|
||||
--num;
|
||||
}
|
||||
*cp++ = '\0';
|
||||
string st{str}; // No const, move optimization
|
||||
return st;
|
||||
// Indent the specified number of spaces.
|
||||
if (num <= 0) return std::string{};
|
||||
return std::string(std::min<size_t>(num, MAXSPACE), ' ');
|
||||
}
|
||||
|
||||
bool V3OutFormatter::tokenMatch(const char* cp, const char* cmp) {
|
||||
|
||||
Reference in New Issue
Block a user