Skip to content

Commit

Permalink
Use string view instead of const ref to string
Browse files Browse the repository at this point in the history
  • Loading branch information
Hind-M committed Jun 15, 2023
1 parent 57166de commit 9d8ddbd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libmamba/include/mamba/core/util_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace mamba
* str1 is considered smaller than (or equal to) str2.
* cf. Channels use case.
*/
std::string get_common_substr(const std::string& str1, const std::string& str2);
std::string get_common_substr(std::string_view str1, std::string_view str2);

/**
* Safe non utf-8 wrapping of <cctype> (see its doc).
Expand Down
4 changes: 2 additions & 2 deletions libmamba/src/core/util_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ namespace mamba
/********************************************************
* Implementation of Channels use case util function *
*******************************************************/
std::string get_common_substr(const std::string& str1, const std::string& str2)
std::string get_common_substr(std::string_view str1, std::string_view str2)
{
auto common_str = str1;
std::string common_str(str1);
while ((str2.find(common_str) == std::string::npos))
{
if (common_str.find('/') != std::string::npos)
Expand Down

0 comments on commit 9d8ddbd

Please sign in to comment.