-
Notifications
You must be signed in to change notification settings - Fork 863
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
Small improvements of CSndLossList::insert #1148
Small improvements of CSndLossList::insert #1148
Conversation
int pos = m_iHead; | ||
while (pos != -1) | ||
{ | ||
::cout << pos << ":[" << m_caSeq[pos].seqstart; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to use LOG*
facility to display it. Even if this is only left for future debugging.
Of course, you'd need std::ostringstream
for intermediate collection, as a single log instruction cannot print a fragment of a line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can LOGF not end the line with \n
like Verb()
allows to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately not. One log instruction always ends with an end of line. Partial-line logging would have to be added support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then would be simpler to leave this type of output for the sake of code simplicity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verb()
has a special VerbNoEOL
tag to leave without EOL. But Verb()
doesn't have a log header, so there's a little problem with this. For LOG*
we'd need something like a temporary log cumulation variable, which will be then reused when doing a final log with EOL. But I don't think we could this way do any better than by using std::ostringstream
.
InsertPopTwoSerialElems InsertCoalesce
6f4c07c
to
f62fdb3
Compare
CSndLossList::insert(..)
.CSndLossList::insert(..)
for the serial element.Example of the improvement. Three insert operations:
The state of the list after every insert operation was (format
pos:[seqstart, seqend]
):After this PR:
Taken from
TEST_F(CSndLossListTest, InsertCoalesce)