Skip to content

Commit

Permalink
Avoid an unnecessary StringPiece
Browse files Browse the repository at this point in the history
Rather than relying on re2::StringPiece (or absl::string_view) to
implement << when inspecting MatchData, use the much simpler write
function.
  • Loading branch information
mudge committed Jan 21, 2024
1 parent 2d3b10e commit 1bbe128
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ext/re2/re2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,9 @@ static VALUE re2_matchdata_inspect(const VALUE self) {
if (match == Qnil) {
output << "nil";
} else {
output << "\"" << re2::StringPiece(RSTRING_PTR(match),
RSTRING_LEN(match)) << "\"";
output << "\"";
output.write(RSTRING_PTR(match), RSTRING_LEN(match));
output << "\"";
}
}

Expand Down

0 comments on commit 1bbe128

Please sign in to comment.