+ // init the "NeverAutoRemove" variable
+ vector<regex_t *> neverAutoRemoveRegexp;
+ Configuration::Item const *Opts;
+ Opts = _config->Tree("APT::NeverAutoRemove");
+ if (Opts != 0 && Opts->Child != 0)
+ {
+ Opts = Opts->Child;
+ for (; Opts != 0; Opts = Opts->Next)
+ {
+ if (Opts->Value.empty() == true)
+ continue;
+
+ regex_t *p = new regex_t;
+ if(regcomp(p,Opts->Value.c_str(),
+ REG_EXTENDED | REG_ICASE | REG_NOSUB) != 0)
+ {
+ regfree(p);
+ for(unsigned int i=0;i<neverAutoRemoveRegexp.size();i++)
+ regfree(neverAutoRemoveRegexp[i]);
+ return _error->Error("Regex compilation error for APT::NeverAutoRemove");
+ }
+ neverAutoRemoveRegexp.push_back(p);
+ }
+ }
+
+
+ // do the mark part, this is the core bit of the algorithm