Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logging central: memseting 6500 bytes is waste of time #520

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions firmware/util/loggingcentral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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
Expand Down
Loading