diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-01-24 14:47:34 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-01-24 14:47:34 +0100 |
commit | 7afbdf254519e93ecf3730656d52e19a8727772c (patch) | |
tree | 710c10e02cfbdc2d6567ce01a55a3ca32b67289e /src/libutil/fmt.hh | |
parent | 45305743634e11053b5b9428b7b1d09df2d47856 (diff) |
hiliteMatches(): Style fixes, pass more stuff by reference
Diffstat (limited to 'src/libutil/fmt.hh')
-rw-r--r-- | src/libutil/fmt.hh | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/libutil/fmt.hh b/src/libutil/fmt.hh index 1f81bfcfb..a7126fb65 100644 --- a/src/libutil/fmt.hh +++ b/src/libutil/fmt.hh @@ -156,12 +156,15 @@ inline hintformat hintfmt(std::string plain_string) return hintfmt("%s", normaltxt(plain_string)); } -/** - * Highlight all the given matches in the given string `s` by wrapping them - * between `prefix` and `postfix`. - * - * If some matches overlap, then their union will be wrapped rather than the - * individual matches. - */ -std::string hiliteMatches(const std::string &s, std::vector<std::smatch> matches, std::string prefix, std::string postfix); +/* Highlight all the given matches in the given string `s` by wrapping + them between `prefix` and `postfix`. + + If some matches overlap, then their union will be wrapped rather + than the individual matches. */ +std::string hiliteMatches( + std::string_view s, + std::vector<std::smatch> matches, + std::string_view prefix, + std::string_view postfix); + } |