From 421b32efb46dd7d99f0e7d4ad410d61dde22eb71 Mon Sep 17 00:00:00 2001 From: Greg Hewgill Date: Sun, 13 Feb 2011 09:55:45 +1300 Subject: [PATCH] use std::stack instead of std::list where appropriate --- lib/settings.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/settings.cpp b/lib/settings.cpp index bf9f6a58e..88cb556ab 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -25,6 +25,7 @@ #include #include // std::isdigit, std::isalnum, etc #include +#include 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 > backtrack; + std::stack > 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++;