From 0312d30315a3a77ab659b742b76ec32685145715 Mon Sep 17 00:00:00 2001 From: Matthew O'Gorman Date: Thu, 19 May 2016 15:42:54 -0400 Subject: this updates issues that were addressed by people in pr --- src/libstore/profiles.cc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/libstore/profiles.cc') diff --git a/src/libstore/profiles.cc b/src/libstore/profiles.cc index e6300cf05552..44c3c6e0d478 100644 --- a/src/libstore/profiles.cc +++ b/src/libstore/profiles.cc @@ -157,15 +157,10 @@ void deleteGenerations(const Path & profile, const std::set & gens } } -void deleteGenerationsGreaterThan(const Path & profile, const string & max, bool dryRun) +void deleteGenerationsGreaterThan(const Path & profile, int max, bool dryRun) { int max_keep = 0; PathLocks lock; - if(max.size() < 2) - throw Error(format("invalid number of generations ‘%1%’") % max); - string str_max = string(max, 1, max.size()); - if (!string2Int(str_max, max_keep) || max_keep == 0) - throw Error(format("invalid number of generations to keep ‘%1%’") % max); lockProfile(lock, profile); @@ -173,11 +168,11 @@ void deleteGenerationsGreaterThan(const Path & profile, const string & max, bool Generations gens = findGenerations(profile, curGen); for (auto i = gens.rbegin(); i != gens.rend(); ++i) { - if (max_keep) { - max_keep--; - continue; - } - deleteGeneration2(profile, i->number, dryRun); + if (max) { + max--; + continue; + } + deleteGeneration2(profile, i->number, dryRun); } } -- cgit 1.4.1