Mercurial > jwe > octave
changeset 29221:0180eaf55fd0 stable
Use static keyword on regexp pattern in file_stat (bug #59706)
* file-stat.cc (file_stat::update_internal): Use static keyword
for variable "pat" of type "regexp". This should require initializing
the regular expression just once, rather than on every function call,
and should improve performance.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 22 Dec 2020 10:48:56 -0800 |
parents | 45abff4199d8 |
children | d50d9fd9ab05 56978d4b266c |
files | liboctave/system/file-stat.cc |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/system/file-stat.cc Mon Dec 21 19:24:58 2020 +0100 +++ b/liboctave/system/file-stat.cc Tue Dec 22 10:48:56 2020 -0800 @@ -206,7 +206,7 @@ // trailing backslash. // FIXME: This pattern does not match all possible UNC roots: // https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/62e862f4-2a51-452e-8eeb-dc4ff5ee33cc - regexp pat (R"(^\\\\[\w.-]+\\[\w\$-]+$)"); + static regexp pat (R"(^\\\\[\w.-]+\\[\w\$-]+$)"); if ((full_file_name.length () == 2 && full_file_name[1] == ':') || (full_file_name.length () > 4 && full_file_name[0] == '\\' && full_file_name[1] == '\\' && pat.is_match (full_file_name)))