From 93f48173c60fd6ac16b1fde9c795cd45423e87cb Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 3 Sep 2006 19:06:28 +0000 Subject: [PATCH] Don't put nulls into the new packages queue Improve algorithm for checking missing packages --- source/builder.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/source/builder.cpp b/source/builder.cpp index e6f036b..b90f2c4 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -132,7 +132,8 @@ Package *Builder::get_package(const string &n) Package *pkg=Package::create(*this, n); packages.insert(PackageMap::value_type(n, pkg)); - new_pkgs.push_back(pkg); + if(pkg) + new_pkgs.push_back(pkg); return pkg; } @@ -216,17 +217,12 @@ int Builder::main() std::list missing; for(PackageMap::iterator i=packages.begin(); i!=packages.end(); ++i) - { - const list &requires=i->second->get_requires(); - for(list::const_iterator j=requires.begin(); j!=requires.end(); ++j) - if(!j->get_package()) - missing.push_back(j->get_name()); - } + if(!i->second) + missing.push_back(i->first); if(!missing.empty()) { missing.sort(); - missing.unique(); cerr<<"The following packages were not found on the system:\n"; for(list::iterator i=missing.begin(); i!=missing.end(); ++i) cerr<<" "<<*i<<'\n'; -- 2.45.2