mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2026-06-15 08:17:05 +00:00
refactor: compile channel name validation regex only once
- the pattern is constant; compiling it on every Validate() call is wasted work and, when channels are validated from multiple threads, needlessly exercises libstdc++'s lazily-populated ctype caches
This commit is contained in:
committed by
Dennis Klein
parent
19e607e486
commit
fc69b5e7ae
@@ -181,7 +181,8 @@ try {
|
|||||||
|
|
||||||
// validate channel name
|
// validate channel name
|
||||||
smatch m;
|
smatch m;
|
||||||
if (regex_search(fName, m, regex(R"([^a-zA-Z0-9\-_\[\]#])"))) {
|
static regex const invalidName(R"([^a-zA-Z0-9\-_\[\]#])");
|
||||||
|
if (regex_search(fName, m, invalidName)) {
|
||||||
ss << "INVALID";
|
ss << "INVALID";
|
||||||
LOG(debug) << ss.str();
|
LOG(debug) << ss.str();
|
||||||
LOG(error) << "channel name contains illegal character: '" << m.str(0) << "', allowed characters are: a-z, A-Z, 0-9, -, _, [, ], #";
|
LOG(error) << "channel name contains illegal character: '" << m.str(0) << "', allowed characters are: a-z, A-Z, 0-9, -, _, [, ], #";
|
||||||
|
|||||||
Reference in New Issue
Block a user