Mercurial > octave
changeset 29212:cf059093ffbc
stat: Make regular expression for Windows a static const (bug #59706).
* liboctave/system/file-stat.cc (file_stat::update_internal): Make regular
expression for Windows a static const.
* liboctave/util/lo-regexp.h, liboctave/util/lo-regexp.cc (is_match): Make
member function a const.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Mon, 21 Dec 2020 16:48:11 +0100 |
parents | 649920d8a5bf |
children | 397d043bb2ff |
files | liboctave/system/file-stat.cc liboctave/util/lo-regexp.cc liboctave/util/lo-regexp.h |
diffstat | 3 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/system/file-stat.cc Mon Dec 21 11:53:10 2020 +0100 +++ b/liboctave/system/file-stat.cc Mon Dec 21 16:48:11 2020 +0100 @@ -205,7 +205,7 @@ // If path is a root (like "C:" or "\\SERVER\share"), add a // trailing backslash. // FIXME: Does this pattern match all possible UNC roots? - regexp pat (R"(^\\\\[\w-]*\\[\w-]*$)"); + static const regexp pat (R"(^\\\\[\w-]*\\[\w-]*$)"); if ((full_file_name.length () == 2 && full_file_name[1] == ':') || pat.is_match (full_file_name)) full_file_name += '\\';
--- a/liboctave/util/lo-regexp.cc Mon Dec 21 11:53:10 2020 +0100 +++ b/liboctave/util/lo-regexp.cc Mon Dec 21 16:48:11 2020 +0100 @@ -437,7 +437,7 @@ } bool - regexp::is_match (const std::string& buffer) + regexp::is_match (const std::string& buffer) const { regexp::match_data rx_lst = match (buffer); @@ -445,7 +445,7 @@ } Array<bool> - regexp::is_match (const string_vector& buffer) + regexp::is_match (const string_vector& buffer) const { octave_idx_type len = buffer.numel ();
--- a/liboctave/util/lo-regexp.h Mon Dec 21 11:53:10 2020 +0100 +++ b/liboctave/util/lo-regexp.h Mon Dec 21 16:48:11 2020 +0100 @@ -73,9 +73,9 @@ match_data match (const std::string& buffer); - bool is_match (const std::string& buffer); + bool is_match (const std::string& buffer) const; - Array<bool> is_match (const string_vector& buffer); + Array<bool> is_match (const string_vector& buffer) const; std::string replace (const std::string& buffer, const std::string& replacement);