Not sure if it is really needed, as perf gain and simplification are both very small.
Referring to this:
|
if (!res && size != 0) { |
|
result.resize(size); |
|
res = (S_OK == idebug_->GetNameByOffset( |
|
offset, |
|
&result[0], |
|
static_cast<ULONG>(result.size()), |
|
&size, |
|
0 |
|
)); |
|
trim_right_zeroes(result); |
|
} else if (res) { |
|
result = name; |
|
} |
According to the updated IDebugSymbols::GetNameByOffset documentation, sizes will include the space for exactly one null terminator:
This size includes the space for the '\0' terminating character.
So the assignment in the else branch can be like:
result.assign(name, size - 1);
and trim_right_zeroes can be avoided by resizing string as result.resize(size - 1) prior the second call.
Ditto for GetLineByOffset below.
Not sure if it is really needed, as perf gain and simplification are both very small.
Referring to this:
stacktrace/include/boost/stacktrace/detail/frame_msvc.ipp
Lines 222 to 234 in 75b7986
According to the updated IDebugSymbols::GetNameByOffset documentation, sizes will include the space for exactly one null terminator:
So the assignment in the else branch can be like:
result.assign(name, size - 1);and
trim_right_zeroescan be avoided by resizing string asresult.resize(size - 1)prior the second call.Ditto for
GetLineByOffsetbelow.