From 39ce2f77f4cc64042ca67fc2b4869616000027da Mon Sep 17 00:00:00 2001 From: Yutetsu TAKATSUKASA Date: Sat, 8 May 2021 09:45:58 +0900 Subject: [PATCH] Internals: Remove VerilatedVcd::m_suffixesp. No functional change is intended. (#2933) Reasons are: - it's error prone to keep updating whennever m_suffixes is resized - invalid pointer may be set when there is not signal to trace as in t_trace_dumporder_bad --- include/verilated_vcd_c.cpp | 6 +----- include/verilated_vcd_c.h | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/include/verilated_vcd_c.cpp b/include/verilated_vcd_c.cpp index bfc185c34..ccbccde8e 100644 --- a/include/verilated_vcd_c.cpp +++ b/include/verilated_vcd_c.cpp @@ -99,7 +99,6 @@ VerilatedVcd::VerilatedVcd(VerilatedVcdFile* filep) { m_wrBufp = new char[m_wrChunkSize * 8]; m_wrFlushp = m_wrBufp + m_wrChunkSize * 6; m_writep = m_wrBufp; - m_suffixesp = nullptr; } void VerilatedVcd::open(const char* filename) VL_MT_SAFE_EXCLUDES(m_mutex) { @@ -114,9 +113,6 @@ void VerilatedVcd::open(const char* filename) VL_MT_SAFE_EXCLUDES(m_mutex) { dumpHeader(); - // Get the direct access pointer to the code strings - m_suffixesp = &m_suffixes[0]; // Note: C++11 m_suffixes.data(); - // When using rollover, the first chunk contains the header only. if (m_rolloverMB) openNextImp(true); } @@ -610,7 +606,7 @@ static inline void VerilatedVcdCCopyAndAppendNewLine(char* writep, const char* s } void VerilatedVcd::finishLine(vluint32_t code, char* writep) { - const char* const suffixp = m_suffixesp + code * VL_TRACE_SUFFIX_ENTRY_SIZE; + const char* const suffixp = m_suffixes.data() + code * VL_TRACE_SUFFIX_ENTRY_SIZE; VerilatedVcdCCopyAndAppendNewLine(writep, suffixp); // Now write back the write pointer incremented by the actual size of the diff --git a/include/verilated_vcd_c.h b/include/verilated_vcd_c.h index f9d07a731..f6fdd1494 100644 --- a/include/verilated_vcd_c.h +++ b/include/verilated_vcd_c.h @@ -80,7 +80,6 @@ private: vluint64_t m_wroteBytes = 0; // Number of bytes written to this file std::vector m_suffixes; // VCD line end string codes + metadata - const char* m_suffixesp; // Pointer to first element of above using NameMap = std::map; NameMap* m_namemapp = nullptr; // List of names for the header