Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduler: allow negation of regular expressions in plan class XML specs (standard) #4529

Open
wants to merge 1 commit into
base: dpa_regex
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions sched/plan_class_spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ int REGEX_CLAUSE::init(const char* p) {
present = true;
negate = false;
expr = p;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here copy constructor will be called

if (*p == '!') {
p++;
if (!strncmp(p,"(?!",3) && p[strlen(p)-1] == ')') {
p += 3;
p[strlen(p)-1] = '\0'; // don't parse trailing ')'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point data at expr will not be changed, because you're modifying the original data piece that has nothing common with expr at all.
If this is done by intention - then it's fine.

negate = true;
}
if (regcomp(&regex, p, REG_EXTENDED|REG_NOSUB) ) {
return ERR_XML_PARSE;
}
if (negate) {
p[strlen(p)] = ')'; // restore trailing ')'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the same as above: data stored in expr will not be modified.

}
return 0;
}

Expand Down