optimize utils::strmatch() by using const string reference

This commit is contained in:
Axel Kohlmeyer
2020-07-30 23:42:03 -04:00
parent 814e2e9aaf
commit 8cb63194aa
2 changed files with 3 additions and 3 deletions

View File

@ -82,7 +82,7 @@ using namespace LAMMPS_NS;
* even with char * type variables.
* Example: utils::strmatch(text, std::string("^") + charptr)
*/
bool utils::strmatch(std::string text, std::string pattern)
bool utils::strmatch(const std::string &text, const std::string &pattern)
{
const int pos = re_match(text.c_str(),pattern.c_str());
return (pos >= 0);

View File

@ -35,7 +35,7 @@ namespace LAMMPS_NS {
* \param pattern the search pattern, which may contain regexp markers
* \return true if the pattern matches, false if not
*/
bool strmatch(std::string text, std::string pattern);
bool strmatch(const std::string &text, const std::string &pattern);
/** \brief Send message to screen and logfile, if available
*