use std::stack instead of std::list where appropriate
This commit is contained in:
parent
7a219b1fb8
commit
421b32efb4
|
@ -25,6 +25,7 @@
|
|||
#include <iostream>
|
||||
#include <cctype> // std::isdigit, std::isalnum, etc
|
||||
#include <set>
|
||||
#include <stack>
|
||||
|
||||
Settings::Settings()
|
||||
{
|
||||
|
@ -120,7 +121,7 @@ bool Settings::Suppressions::FileMatcher::match(const std::string &pattern, cons
|
|||
{
|
||||
const char *p = pattern.c_str();
|
||||
const char *n = name.c_str();
|
||||
std::list<std::pair<const char *, const char *> > backtrack;
|
||||
std::stack<std::pair<const char *, const char *> > backtrack;
|
||||
|
||||
for (;;) {
|
||||
bool matching = true;
|
||||
|
@ -133,7 +134,7 @@ bool Settings::Suppressions::FileMatcher::match(const std::string &pattern, cons
|
|||
}
|
||||
if (*n != '\0') {
|
||||
// If this isn't the last possibility, save it for later
|
||||
backtrack.push_back(std::make_pair(p, n));
|
||||
backtrack.push(std::make_pair(p, n));
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
|
@ -167,9 +168,9 @@ bool Settings::Suppressions::FileMatcher::match(const std::string &pattern, cons
|
|||
}
|
||||
|
||||
// Restore pointers from backtrack stack
|
||||
p = backtrack.back().first;
|
||||
n = backtrack.back().second;
|
||||
backtrack.pop_back();
|
||||
p = backtrack.top().first;
|
||||
n = backtrack.top().second;
|
||||
backtrack.pop();
|
||||
|
||||
// Advance name pointer by one because the current position didn't work
|
||||
n++;
|
||||
|
|
Loading…
Reference in New Issue