logging central: memseting 6500 bytes is waste of time

This commit is contained in:
Andrey Gusakov 2024-12-08 19:26:43 +03:00 committed by rusefillc
parent 181be66939
commit 90bd38d637
1 changed files with 3 additions and 4 deletions

View File

@ -47,7 +47,7 @@ size_t LogBuffer<TBufferSize>::length() const {
template <size_t TBufferSize>
void LogBuffer<TBufferSize>::reset() {
m_writePtr = m_buffer;
memset(m_buffer, 0, TBufferSize);
*m_writePtr = '\0';
}
template <size_t TBufferSize>
@ -63,11 +63,10 @@ void LogBuffer<TBufferSize>::writeInternal(const char* buffer) {
// If we can't fit the whole thing, write as much as we can
len = minI(available, len);
// Ensure the output buffer is always null terminated (in case we did a partial write)
*(m_writePtr + len) = '\0';
memcpy(m_writePtr, buffer, len);
m_writePtr += len;
// Ensure the output buffer is always null terminated (in case we did a partial write)
*m_writePtr = '\0';
}
// for unit tests