diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-08-30 11:57:14 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-08-30 11:57:14 +0200 |
commit | 4cb0cd1648e4a2623cb00a11b2db2649e286706d (patch) | |
tree | f629993a945f63f26629affba9feac011e594eb3 /apt-pkg/contrib | |
parent | 61110beb5f398b7f83fa8135bd4e04294ea408b4 (diff) | |
parent | ba91b1518a1208fecc1ca076fd9cfbd28344b5b3 (diff) |
merged lp:~donkult/apt/sid
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r-- | apt-pkg/contrib/configuration.cc | 14 | ||||
-rw-r--r-- | apt-pkg/contrib/configuration.h | 1 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 3 |
3 files changed, 14 insertions, 4 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 81cc87d15..cc7093fe2 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -857,19 +857,27 @@ Configuration::MatchAgainstConfig::MatchAgainstConfig(char const * Config) { regfree(p); delete p; + clearPatterns(); _error->Warning("Regex compilation error for '%s' in configuration option '%s'", s->c_str(), Config); + return; } - } - + } + if (strings.size() == 0) + patterns.push_back(NULL); } /*}}}*/ // MatchAgainstConfig Destructor /*{{{*/ Configuration::MatchAgainstConfig::~MatchAgainstConfig() { + clearPatterns(); +} +void Configuration::MatchAgainstConfig::clearPatterns() +{ for(std::vector<regex_t *>::const_iterator p = patterns.begin(); p != patterns.end(); ++p) { + if (*p == NULL) continue; regfree(*p); delete *p; } @@ -880,7 +888,7 @@ bool Configuration::MatchAgainstConfig::Match(char const * str) const { for(std::vector<regex_t *>::const_iterator p = patterns.begin(); p != patterns.end(); ++p) - if (regexec(*p, str, 0, 0, 0) == 0) + if (*p != NULL && regexec(*p, str, 0, 0, 0) == 0) return true; return false; diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h index cbe18e4e5..175c1bef3 100644 --- a/apt-pkg/contrib/configuration.h +++ b/apt-pkg/contrib/configuration.h @@ -109,6 +109,7 @@ class Configuration class MatchAgainstConfig { std::vector<regex_t *> patterns; + void clearPatterns(); public: MatchAgainstConfig(char const * Config); diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 91aecee65..2b73d1424 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -309,7 +309,8 @@ std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> c { if (Debug == true) std::clog << "Bad file: " << Ent->d_name << " → no extension" << std::endl; - _error->Notice("Ignoring file '%s' in directory '%s' as it has no filename extension", Ent->d_name, Dir.c_str()); + if (SilentIgnore.Match(Ent->d_name) == false) + _error->Notice("Ignoring file '%s' in directory '%s' as it has no filename extension", Ent->d_name, Dir.c_str()); continue; } } |