Skip to content

Commit bf01bb8

Browse files
[lldb] Refactor string manipulation in Debugger.cpp (llvm#92565)
Summary of Changes: Replaced the ineffective call to `substr` with a more efficient use of `resize` to truncate the string. Adjusted the code to use 'resize' instead of 'substr' for better performance and readability. Removed unwanted file from the previous commit. Fixes: llvm#91209 --------- Co-authored-by: aabhinavg <[email protected]>
1 parent a256e89 commit bf01bb8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lldb/source/Core/Debugger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2116,7 +2116,7 @@ void Debugger::HandleProgressEvent(const lldb::EventSP &event_sp) {
21162116
const uint32_t term_width = GetTerminalWidth();
21172117
const uint32_t ellipsis = 3;
21182118
if (message.size() + ellipsis >= term_width)
2119-
message = message.substr(0, term_width - ellipsis);
2119+
message.resize(term_width - ellipsis);
21202120

21212121
const bool use_color = GetUseColor();
21222122
llvm::StringRef ansi_prefix = GetShowProgressAnsiPrefix();

0 commit comments

Comments
 (0)