diff --git a/include/verilated_vcd_c.cpp b/include/verilated_vcd_c.cpp index 1d498b30e..8ae2256ff 100644 --- a/include/verilated_vcd_c.cpp +++ b/include/verilated_vcd_c.cpp @@ -325,7 +325,7 @@ void VerilatedVcd::printQuad(vluint64_t n) { void VerilatedVcd::printTime(vluint64_t timeui) { // VCD file format specification does not allow non-integers for timestamps - // Dinotrace doesn't mind, but Cadence vvision seems to choke + // Dinotrace doesn't mind, but Cadence Vision seems to choke if (VL_UNLIKELY(timeui < m_timeLastDump)) { timeui = m_timeLastDump; static VL_THREAD_LOCAL bool backTime = false; diff --git a/src/V3File.cpp b/src/V3File.cpp index b74556bcf..d7f94ed2f 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -587,25 +587,6 @@ V3OutFormatter::V3OutFormatter(const string& filename, V3OutFormatter::Language //---------------------------------------------------------------------- -const char* V3OutFormatter::indentStr(int num) { - // Indent the specified number of spaces. Use tabs as possible. - static char str[MAXSPACE+20]; - char* cp = str; - if (num>MAXSPACE) num = MAXSPACE; - if (m_lang!=LA_VERILOG && m_lang!=LA_XML) { // verilogPrefixedTree doesn't want tabs - while (num>=8) { - *cp++ = '\t'; - num -= 8; - } - } - while (num>0) { - *cp++ = ' '; - num --; - } - *cp++ = '\0'; - return (str); -} - const string V3OutFormatter::indentSpaces(int num) { // Indent the specified number of spaces. Use spaces. static char str[MAXSPACE+20]; @@ -639,6 +620,8 @@ int V3OutFormatter::endLevels(const char *strg) { const char* cp = strg; while (isspace(*cp)) cp++; switch (*cp) { + case '\0': // End of string... No need for whitespace before it + return (0); case '\n': // Newlines.. No need for whitespace before it return (0); case '#': // Preproc directive @@ -680,7 +663,7 @@ int V3OutFormatter::endLevels(const char *strg) { void V3OutFormatter::puts(const char *strg) { if (m_prependIndent) { - putsNoTracking(indentStr(endLevels(strg))); + putsNoTracking(indentSpaces(endLevels(strg))); m_prependIndent = false; } bool wordstart = true; @@ -695,7 +678,7 @@ void V3OutFormatter::puts(const char *strg) { m_prependIndent = true; // Add the indent later, may be a indentInc/indentDec called between now and then } else { m_prependIndent = false; - putsNoTracking(indentStr(endLevels(cp+1))); + putsNoTracking(indentSpaces(endLevels(cp+1))); } break; case ' ': @@ -808,7 +791,7 @@ void V3OutFormatter::putBreak() { //char s[1000]; sprintf(s, "{%d,%d}", m_column, m_parenVec.top()); putsNoTracking(s); if (exceededWidth()) { putcNoTracking('\n'); - if (!m_parenVec.empty()) putsNoTracking(indentStr(m_parenVec.top())); + if (!m_parenVec.empty()) putsNoTracking(indentSpaces(m_parenVec.top())); } } } diff --git a/src/V3File.h b/src/V3File.h index 58be331db..2ba197974 100644 --- a/src/V3File.h +++ b/src/V3File.h @@ -129,7 +129,6 @@ private: int m_bracketLevel; // Intenting = { block, indicates number of {'s seen. int endLevels(const char* strg); - const char* indentStr(int num); void putcNoTracking(char chr); public: