Use string_view for a couple of Dbg methods

This commit is contained in:
Tim Wojtulewicz 2020-02-03 11:35:26 -05:00
parent eda1b4a23e
commit 92afe64525
3 changed files with 5 additions and 5 deletions

View file

@ -119,7 +119,7 @@ void DbgBreakpoint::RemoveFromStmt()
} }
bool DbgBreakpoint::SetLocation(ParseLocationRec plr, string loc_str) bool DbgBreakpoint::SetLocation(ParseLocationRec plr, string_view loc_str)
{ {
if ( plr.type == plrUnknown ) if ( plr.type == plrUnknown )
{ {
@ -150,7 +150,7 @@ bool DbgBreakpoint::SetLocation(ParseLocationRec plr, string loc_str)
{ {
kind = BP_FUNC; kind = BP_FUNC;
function_name = make_full_var_name(current_module.c_str(), function_name = make_full_var_name(current_module.c_str(),
loc_str.c_str()); loc_str.data());
at_stmt = plr.stmt; at_stmt = plr.stmt;
const Location* loc = at_stmt->GetLocationInfo(); const Location* loc = at_stmt->GetLocationInfo();
snprintf(description, sizeof(description), "%s at %s:%d", snprintf(description, sizeof(description), "%s at %s:%d",

View file

@ -21,7 +21,7 @@ public:
void SetID(int newID) { BPID = newID; } void SetID(int newID) { BPID = newID; }
// True if breakpoint could be set; false otherwise // True if breakpoint could be set; false otherwise
bool SetLocation(ParseLocationRec plr, string loc_str); bool SetLocation(ParseLocationRec plr, string_view loc_str);
bool SetLocation(Stmt* stmt); bool SetLocation(Stmt* stmt);
bool SetLocation(double time); bool SetLocation(double time);

View file

@ -27,9 +27,9 @@
// //
// Helper routines // Helper routines
// //
bool string_is_regex(string s) bool string_is_regex(string_view s)
{ {
return strpbrk(s.c_str(), "?*\\+"); return strpbrk(s.data(), "?*\\+");
} }
void lookup_global_symbols_regex(const string& orig_regex, vector<ID*>& matches, void lookup_global_symbols_regex(const string& orig_regex, vector<ID*>& matches,