diff options
author | Daniel Burrows <dburrows@debian.org> | 2005-11-05 20:29:53 +0000 |
---|---|---|
committer | Daniel Burrows <dburrows@debian.org> | 2005-11-05 20:29:53 +0000 |
commit | b3ab2254240fec7f3b880023309f383a5f13cd01 (patch) | |
tree | bed94e0528cd078ae301df0156d19aaabef512b1 | |
parent | 7eed2e3b535885f3008d4aec740969c5d4e163de (diff) | |
download | aptitude-b3ab2254240fec7f3b880023309f383a5f13cd01.tar.gz |
[aptitude @ Replace all uses of assert with eassert.]
64 files changed, 248 insertions, 240 deletions
diff --git a/src/apt_options.cc b/src/apt_options.cc index 6a1fcba7..80c42fbf 100644 --- a/src/apt_options.cc +++ b/src/apt_options.cc @@ -298,9 +298,9 @@ static vs_widget_ref realize_options_dialog(option_item *items) break; case option_item::OPTION_RADIO: { - assert(items->choices.size()==items->choice_descriptions.size()); + eassert(items->choices.size()==items->choice_descriptions.size()); - assert(items->choices.size()>0); + eassert(items->choices.size()>0); apt_radio_widget *w=new apt_radio_widget(items->option_name, items->choices, @@ -345,7 +345,7 @@ static vs_widget_ref realize_options_dialog(option_item *items) break; default: - assert(0); // Someone probably goofed in setting the tables up + eassert(0); // Someone probably goofed in setting the tables up } items++; diff --git a/src/broken_indicator.cc b/src/broken_indicator.cc index 601818bf..ac207344 100644 --- a/src/broken_indicator.cc +++ b/src/broken_indicator.cc @@ -287,7 +287,7 @@ public: pkgCache::VerIterator newver=i->second.ver.get_ver(); // If not, we have a problem. - assert(instver!=newver); + eassert(instver!=newver); if(newver == curver) ++keep_count; @@ -302,7 +302,7 @@ public: // The versions shouldn't be equal -- otherwise // something is majorly wrong. - // assert(cmp!=0); + // eassert(cmp!=0); // // The above is not true: consider, eg, the case of a // locally compiled package and a standard package. diff --git a/src/cmdline/cmdline_resolver.cc b/src/cmdline/cmdline_resolver.cc index 9a59fa53..9405b188 100644 --- a/src/cmdline/cmdline_resolver.cc +++ b/src/cmdline/cmdline_resolver.cc @@ -189,7 +189,7 @@ static void resolver_help(ostream &out) // Given several versions with the same VerStr, choose one to output. static pkgCache::VerIterator choose_version(const vector<pkgCache::VerIterator> &choices) { - assert(!choices.empty()); + eassert(!choices.empty()); if(choices.size() == 1) return choices.front(); @@ -272,8 +272,8 @@ static void reject_or_mandate_version(const string &s, ver = aptitude_universe::version(pkg, choose_version(found), *apt_cache_file); - assert(!ver.get_ver().end()); - assert(ver.get_pkg() == ver.get_ver().ParentPkg()); + eassert(!ver.get_ver().end()); + eassert(ver.get_pkg() == ver.get_ver().ParentPkg()); } if(is_reject) diff --git a/src/download_item.cc b/src/download_item.cc index 164d2aca..30ad60d9 100644 --- a/src/download_item.cc +++ b/src/download_item.cc @@ -45,7 +45,7 @@ style download_item::get_normal_style() case pkgAcquire::Item::StatAuthError: return vs_treeitem::get_normal_style()+get_style("Error"); default: - assert(0); + eassert(0); } } @@ -76,7 +76,7 @@ void download_item::paint(vs_tree *win, int y, bool hierarchical, output+=_(" [Working]"); else { - assert(worker->CurrentItem->Owner==item.Owner); + eassert(worker->CurrentItem->Owner==item.Owner); if(worker->TotalSize>0) { diff --git a/src/download_screen.cc b/src/download_screen.cc index eb7f46a0..c22e8a1f 100644 --- a/src/download_screen.cc +++ b/src/download_screen.cc @@ -25,7 +25,7 @@ #include "download_item.h" #include "ui.h" -#include <assert.h> +#include <generic/util/eassert.h> #include <signal.h> #include <apt-pkg/strutl.h> diff --git a/src/download_screen.h b/src/download_screen.h index 060c73f0..5927da54 100644 --- a/src/download_screen.h +++ b/src/download_screen.h @@ -89,7 +89,7 @@ class download_screen:public vs_tree, public pkgAcquireStatus download_item *get_itm(pkgAcquire::ItemDesc &itmdesc) { downloadmap::iterator found=active_items.find(itmdesc.Owner); - assert(found!=active_items.end()); + eassert(found!=active_items.end()); return found->second; } diff --git a/src/generic/apt/apt.cc b/src/generic/apt/apt.cc index c2159487..c2550794 100644 --- a/src/generic/apt/apt.cc +++ b/src/generic/apt/apt.cc @@ -44,7 +44,7 @@ #include <fstream> -#include <assert.h> +#include <generic/util/eassert.h> #include <signal.h> #include <unistd.h> #include <sys/stat.h> @@ -456,7 +456,7 @@ static void surrounding_or_internal(const pkgCache::DepIterator &dep, } // If not, something is wrong with apt's cache. - assert(found); + eassert(found); } void surrounding_or(pkgCache::DepIterator dep, diff --git a/src/generic/apt/aptcache.cc b/src/generic/apt/aptcache.cc index 7edf50b8..b222c9f0 100644 --- a/src/generic/apt/aptcache.cc +++ b/src/generic/apt/aptcache.cc @@ -45,7 +45,7 @@ #include <unistd.h> #include <stdio.h> #include <errno.h> -#include <assert.h> +#include <generic/util/eassert.h> #include <sigc++/adaptors/bind.h> #include <sigc++/functors/mem_fun.h> @@ -1246,7 +1246,7 @@ void aptitudeDepCache::begin_action_group() void aptitudeDepCache::end_action_group(undo_group *undo) { - assert(group_level>0); + eassert(group_level>0); if(group_level==1) { diff --git a/src/generic/apt/aptitude_resolver_universe.cc b/src/generic/apt/aptitude_resolver_universe.cc index efc4829b..962e1746 100644 --- a/src/generic/apt/aptitude_resolver_universe.cc +++ b/src/generic/apt/aptitude_resolver_universe.cc @@ -41,7 +41,7 @@ string aptitude_resolver_version::get_name() const // if not, we have a "version" of this package that's not in // its list of versions! - assert(idx>=0); + eassert(idx>=0); if(count>1) { @@ -82,7 +82,7 @@ void aptitude_resolver_version::revdep_iterator::normalize() if(dep_lst.end() && !provides_open) { - assert(prv_lst.end()); + eassert(prv_lst.end()); prv_lst=ver.ProvidesList(); provides_open=true; if(!prv_lst.end()) @@ -96,12 +96,12 @@ void aptitude_resolver_version::revdep_iterator::normalize() // When we've run out of provides, give up.. while(dep_lst.end() && !prv_lst.end()) { - assert(provides_open); + eassert(provides_open); ++prv_lst; if(!prv_lst.end()) { - assert(!prv_lst.ParentPkg().end()); + eassert(!prv_lst.ParentPkg().end()); dep_lst=prv_lst.ParentPkg().RevDependsList(); while(!dep_lst.end() && !applicable()) @@ -114,8 +114,8 @@ void aptitude_resolver_version::dep_iterator::normalize() { if(prv_open) { - assert(!dep.end()); - assert(dep->Type == pkgCache::Dep::Conflicts); + eassert(!dep.end()); + eassert(dep->Type == pkgCache::Dep::Conflicts); while(!prv.end() && prv.OwnerPkg()==dep.ParentPkg()) ++prv; @@ -129,7 +129,7 @@ void aptitude_resolver_version::dep_iterator::normalize() return; } - assert(!prv_open); + eassert(!prv_open); // Skip non-critical and self dependencies. Need to do this here @@ -196,7 +196,7 @@ void aptitude_resolver_dep::solver_iterator::normalize() ++dep_lst; // Since we aren't finished, dep_lst should still be // valid. - assert(!dep_lst.end()); + eassert(!dep_lst.end()); ver_lst=dep_lst.TargetPkg().VersionList(); // Only set the prv_lst to non-end if there is no target @@ -318,7 +318,7 @@ bool aptitude_resolver_dep::solved_by(const aptitude_resolver_version &v) const aptitude_resolver_dep::solver_iterator &aptitude_resolver_dep::solver_iterator::operator++() { - assert(!end()); + eassert(!end()); // Advance whatever needs to be advanced next in the // sub-list. @@ -340,7 +340,7 @@ aptitude_resolver_dep::solver_iterator &aptitude_resolver_dep::solver_iterator:: aptitude_resolver_version::dep_iterator &aptitude_resolver_version::dep_iterator::operator++() { - assert(!dep.end()); + eassert(!dep.end()); // If the Provides list is nonempty, advance it. if(!prv.end()) @@ -379,7 +379,7 @@ aptitude_resolver_version::dep_iterator &aptitude_resolver_version::dep_iterator aptitude_resolver_version aptitude_resolver_dep::solver_iterator::operator*() const { - assert(!end()); + eassert(!end()); if(!ver_lst.end()) return aptitude_resolver_version(ver_lst.ParentPkg(),ver_lst,cache); @@ -388,7 +388,7 @@ aptitude_resolver_version aptitude_resolver_dep::solver_iterator::operator*() co if(dep_lst->Type != pkgCache::Dep::Conflicts) { // Assume this because otherwise end() should be true. - assert(!prv_lst.end()); + eassert(!prv_lst.end()); return aptitude_resolver_version(const_cast<pkgCache::PrvIterator &>(prv_lst).OwnerPkg(),const_cast<pkgCache::PrvIterator &>(prv_lst).OwnerVer(),cache); } @@ -465,7 +465,7 @@ void aptitude_universe::broken_dep_iterator::normalize() } } - assert(the_dep.end() || is_interesting_dep(the_dep, cache)); + eassert(the_dep.end() || is_interesting_dep(the_dep, cache)); // Now dep is a broken critical dep or an end dep. If it is a // conflicts, we might need to push down into Provides... @@ -543,9 +543,9 @@ void aptitude_universe::broken_dep_iterator::normalize() aptitude_universe::broken_dep_iterator &aptitude_universe::broken_dep_iterator::operator++() { - assert(!pkg.end()); + eassert(!pkg.end()); // If the_dep.end() we have pkg.end(). - assert(!the_dep.end()); + eassert(!the_dep.end()); if(!prv_open && the_dep->Type == pkgCache::Dep::Conflicts) { diff --git a/src/generic/apt/aptitude_resolver_universe.h b/src/generic/apt/aptitude_resolver_universe.h index 2383cd9d..9e5562cf 100644 --- a/src/generic/apt/aptitude_resolver_universe.h +++ b/src/generic/apt/aptitude_resolver_universe.h @@ -24,6 +24,8 @@ #include <apt-pkg/pkgsystem.h> #include <apt-pkg/version.h> +#include <generic/util/eassert.h> + #include "apt.h" #include "aptcache.h" @@ -56,8 +58,8 @@ public: pkgDepCache *_cache) :cache(_cache), pkg(_pkg) { - assert(cache!=0); - assert(pkg.Cache()!=0); + eassert(cache!=0); + eassert(pkg.Cache()!=0); } /** \brief Generate a unique ID for this package. @@ -145,9 +147,9 @@ public: pkgDepCache *_cache) :cache(_cache), pkg(_pkg), ver(_ver) { - assert(cache!=0); - assert(pkg.Cache()!=0); - assert(ver.Cache()!=0); + eassert(cache!=0); + eassert(pkg.Cache()!=0); + eassert(ver.Cache()!=0); } /** \return The APT package of which this is a version. @@ -314,10 +316,10 @@ public: pkgDepCache *_cache) :cache(_cache), prv(_prv) { - assert(cache!=0); - assert(const_cast<pkgCache::DepIterator &>(dep).Cache()!=0); - assert(prv.Cache()!=0); - assert(!dep.end()); + eassert(cache!=0); + eassert(const_cast<pkgCache::DepIterator &>(dep).Cache()!=0); + eassert(prv.Cache()!=0); + eassert(!dep.end()); if(dep->Type != pkgCache::Dep::Conflicts) { // Throw away the end, since it's not necessary. @@ -402,8 +404,8 @@ public: /** \return The source version of this dependency. */ aptitude_resolver_version get_source() const { - assert(!start.end()); - assert(!const_cast<pkgCache::DepIterator &>(start).ParentPkg().end()); + eassert(!start.end()); + eassert(!const_cast<pkgCache::DepIterator &>(start).ParentPkg().end()); return aptitude_resolver_version(const_cast<pkgCache::DepIterator &>(start).ParentPkg(), const_cast<pkgCache::DepIterator &>(start).ParentVer(), cache); @@ -732,7 +734,7 @@ public: { if(!dep_lst.end()) { - assert(dep_lst->Type != pkgCache::Dep::Conflicts); + eassert(dep_lst->Type != pkgCache::Dep::Conflicts); ver_lst=const_cast<pkgCache::DepIterator &>(start).TargetPkg().VersionList(); prv_lst=const_cast<pkgCache::DepIterator &>(start).TargetPkg().ProvidesList(); @@ -758,7 +760,7 @@ public: { if(!dep_lst.end()) { - assert(d->Type == pkgCache::Dep::Conflicts); + eassert(d->Type == pkgCache::Dep::Conflicts); // Either we're looking at all versions of the named dep, or // at all versions of the providing package. if(prv_lst.end()) @@ -1023,7 +1025,7 @@ public: */ dep_iterator &operator++() { - assert(!dep.end()); + eassert(!dep.end()); ++dep; diff --git a/src/generic/apt/download_signal_log.cc b/src/generic/apt/download_signal_log.cc index e27ac003..8a1d5dc8 100644 --- a/src/generic/apt/download_signal_log.cc +++ b/src/generic/apt/download_signal_log.cc @@ -64,7 +64,7 @@ bool download_signal_log::MediaChange(string Media, string Drive) // Sanity-check against broken slots. Something ought to have // called this. if(!MediaChange_sig.empty()) - assert(rval != -1); + eassert(rval != -1); return rval != 0; } @@ -103,7 +103,7 @@ bool download_signal_log::Pulse(pkgAcquire *Owner) Pulse(Owner, sigc::bind(sigc::ptr_fun(set_bool), &rval)); if(!Pulse_sig.empty()) - assert(rval != -1); + eassert(rval != -1); return rval != 0; } diff --git a/src/generic/apt/matchers.cc b/src/generic/apt/matchers.cc index 0b1b3bd3..e019a720 100644 --- a/src/generic/apt/matchers.cc +++ b/src/generic/apt/matchers.cc @@ -50,7 +50,7 @@ #include <apt-pkg/pkgsystem.h> #include <apt-pkg/version.h> -#include <assert.h> +#include <generic/util/eassert.h> #include <ctype.h> #include <stdio.h> #include <regex.h> @@ -1046,7 +1046,7 @@ public: bool matches(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver) { - assert(!pkg.end()); + eassert(!pkg.end()); if(ver.end()) return false; @@ -1085,7 +1085,7 @@ public: pkg_match_result *get_match(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver) { - assert(!pkg.end()); + eassert(!pkg.end()); if(ver.end()) return NULL; @@ -1919,7 +1919,7 @@ std::string parse_substr(string::const_iterator &start, if(start == end) throw CompilationException(_("Unterminated literal string after %s"), rval.c_str()); - assert(*start == '"'); + eassert(*start == '"'); ++start; } diff --git a/src/generic/apt/resolver_manager.cc b/src/generic/apt/resolver_manager.cc index c2ae2642..cbee8664 100644 --- a/src/generic/apt/resolver_manager.cc +++ b/src/generic/apt/resolver_manager.cc @@ -61,7 +61,7 @@ resolver_manager::resolver_manager(aptitudeDepCache *_cache) resolver_manager::~resolver_manager() { - assert(background_thread_running); + eassert(background_thread_running); discard_resolver(); @@ -301,7 +301,7 @@ void resolver_manager::unsuspend_background_thread() threads::mutex::lock control_lock(background_control_mutex); - assert(background_thread_suspend_count > 0); + eassert(background_thread_suspend_count > 0); --background_thread_suspend_count; background_control_cond.wake_all(); } @@ -357,7 +357,7 @@ void resolver_manager::discard_resolver() void resolver_manager::create_resolver() { threads::mutex::lock l(mutex); - assert(resolver == NULL); + eassert(resolver == NULL); // NOTE: the performance of the resolver is highly sensitive to // these settings; choosing bad ones can result in hitting @@ -409,7 +409,7 @@ void resolver_manager::set_debug(bool activate) threads::mutex::lock l(mutex); background_suspender bs(*this); - assert(resolver_exists()); + eassert(resolver_exists()); resolver->set_debug(activate); } @@ -579,7 +579,7 @@ const aptitude_resolver::solution &resolver_manager::get_solution(unsigned int s { threads::mutex::lock l(mutex); - assert(resolver); + eassert(resolver); { threads::mutex::lock l2(solutions_mutex); @@ -620,7 +620,7 @@ void resolver_manager::get_solution_background(unsigned int solution_num, // decreasing the maximum number of steps to search. background_suspender bs(*this); - assert(resolver_exists()); + eassert(resolver_exists()); threads::mutex::lock sol_l(solutions_mutex); if(solution_num < solutions.size()) @@ -757,7 +757,7 @@ void resolver_manager::unreject_version(const aptitude_resolver_version &ver) bool resolver_manager::is_rejected(const aptitude_resolver_version &ver) { threads::mutex::lock l(mutex); - assert(resolver); + eassert(resolver); return resolver->is_rejected(ver); } @@ -775,7 +775,7 @@ void resolver_manager::unmandate_version(const aptitude_resolver_version &ver) bool resolver_manager::is_mandatory(const aptitude_resolver_version &ver) { threads::mutex::lock l(mutex); - assert(resolver); + eassert(resolver); return resolver->is_mandatory(ver); } @@ -793,7 +793,7 @@ void resolver_manager::unharden_dep(const aptitude_resolver_dep &dep) bool resolver_manager::is_hardened(const aptitude_resolver_dep &dep) { threads::mutex::lock l(mutex); - assert(resolver); + eassert(resolver); return resolver->is_hardened(dep); } @@ -811,7 +811,7 @@ void resolver_manager::unapprove_broken_dep(const aptitude_resolver_dep &dep) bool resolver_manager::is_approved_broken(const aptitude_resolver_dep &dep) { threads::mutex::lock l(mutex); - assert(resolver != NULL); + eassert(resolver != NULL); return resolver->is_approved_broken(dep); } @@ -890,8 +890,8 @@ void resolver_manager::tweak_score(const pkgCache::PkgIterator &pkg, threads::mutex::lock l(mutex); background_suspender bs(*this); - assert(resolver_exists()); - assert(resolver->fresh()); + eassert(resolver_exists()); + eassert(resolver->fresh()); resolver->add_version_score(aptitude_resolver_version(pkg, ver, cache), score); diff --git a/src/generic/apt/tags.cc b/src/generic/apt/tags.cc index 08128a45..52f6de1e 100644 --- a/src/generic/apt/tags.cc +++ b/src/generic/apt/tags.cc @@ -37,6 +37,8 @@ #include <apt-pkg/pkgrecords.h> #include <apt-pkg/tagfile.h> +#include <generic/util/eassert.h> + using namespace std; tag::tag(std::string::const_iterator start, @@ -153,8 +155,8 @@ static void insert_tags(const pkgCache::VerIterator &ver, const char *tagstart, *tagend; pkgTagSection sec; - assert(apt_package_records); - assert(tagDB); + eassert(apt_package_records); + eassert(tagDB); apt_package_records->Lookup(vf).GetRec(recstart, recend); if(!recstart || !recend) @@ -188,7 +190,7 @@ const set<tag> *get_tags(const pkgCache::PkgIterator &pkg) bool initialized_reset_signal; void load_tags(OpProgress &progress) { - assert(apt_cache_file && apt_package_records); + eassert(apt_cache_file && apt_package_records); if(!initialized_reset_signal) { @@ -238,7 +240,7 @@ static void init_vocabulary() { if(facet_descriptions != NULL) { - assert(tag_descriptions != NULL); + eassert(tag_descriptions != NULL); return; } diff --git a/src/generic/apt/tasks.cc b/src/generic/apt/tasks.cc index 719888b0..3536eead 100644 --- a/src/generic/apt/tasks.cc +++ b/src/generic/apt/tasks.cc @@ -11,7 +11,7 @@ #include <apt-pkg/pkgrecords.h> #include <apt-pkg/tagfile.h> -#include <assert.h> +#include <generic/util/eassert.h> #include <errno.h> #include <ctype.h> @@ -46,7 +46,7 @@ static void update_tasks(const pkgCache::PkgIterator &pkg, { // This should never be called before load_tasks has initialized the // tasks structure. - assert(tasks_by_package); + eassert(tasks_by_package); list<string> &lst=tasks_by_package[pkg->ID]; diff --git a/src/generic/problemresolver/dummy_universe.cc b/src/generic/problemresolver/dummy_universe.cc index 8ca1d031..517919e8 100644 --- a/src/generic/problemresolver/dummy_universe.cc +++ b/src/generic/problemresolver/dummy_universe.cc @@ -109,7 +109,7 @@ void dummy_universe::add_package(const string &name, vector<string> the_versions, const string &curname) { - assert(!the_versions.empty()); + eassert(!the_versions.empty()); packages.push_back(new dummy_package(name, packages.size())); diff --git a/src/generic/problemresolver/dummy_universe.h b/src/generic/problemresolver/dummy_universe.h index 9ded6378..670252dc 100644 --- a/src/generic/problemresolver/dummy_universe.h +++ b/src/generic/problemresolver/dummy_universe.h @@ -29,6 +29,7 @@ #include <string> #include <vector> +#include <generic/util/eassert.h> #include <generic/util/exception.h> // An error type that's thrown when a name lookup fails. @@ -503,7 +504,7 @@ public: const dep operator*() const { - assert(realiter!=realend); + eassert(realiter!=realend); return *realiter; } diff --git a/src/generic/problemresolver/problemresolver.h b/src/generic/problemresolver/problemresolver.h index 97538260..05fefb62 100644 --- a/src/generic/problemresolver/problemresolver.h +++ b/src/generic/problemresolver/problemresolver.h @@ -39,7 +39,7 @@ #ifndef PROBLEMRESOLVER_H #define PROBLEMRESOLVER_H -#include <assert.h> +#include <generic/util/eassert.h> #include <algorithm> #include <map> @@ -508,7 +508,7 @@ private: ~instance_tracker() { threads::mutex::lock l(r.execution_mutex); - assert(r.solver_executing); + eassert(r.solver_executing); r.solver_executing = false; r.solver_cancelled = false; @@ -1024,7 +1024,7 @@ private: void install(const package &p, const version &v) { - assert(installations.find(p) == installations.end()); + eassert(installations.find(p) == installations.end()); installations[p]=v; } @@ -1252,7 +1252,7 @@ private: while(!broken_deps.empty()) { - assert(!avail_versions.empty()); + eassert(!avail_versions.empty()); // Pick an "arbitrary" broken dependency. dep d = *broken_deps.begin(); @@ -1283,9 +1283,9 @@ private: // I have a proof that a solver should exist, but that doesn't // mean it does ;-) - assert(found_one); - assert(output_actions.find(solver.get_package()) == output_actions.end()); - assert(solver != solver.get_package().current_version()); + eassert(found_one); + eassert(output_actions.find(solver.get_package()) == output_actions.end()); + eassert(solver != solver.get_package().current_version()); if(debug) std::cout << "Filter: resolving " << d << " with " @@ -1334,7 +1334,7 @@ private: */ solution eliminate_stupid(const solution &s) { - assert(s.get_broken().empty()); + eassert(s.get_broken().empty()); stupid_table stupid_pairs; @@ -1397,7 +1397,7 @@ private: << first_broken << std::endl; typename std::map<package, action>::const_iterator found = rval.get_actions().find(victim.first.get_package()); - assert(found != rval.get_actions().end()); + eassert(found != rval.get_actions().end()); action repl_action(victim.first, first_broken, found->second.id); @@ -1469,7 +1469,7 @@ private: } } - assert(rval.get_broken().empty()); + eassert(rval.get_broken().empty()); return rval; } @@ -1763,7 +1763,7 @@ private: } else { - assert(v != cur); + eassert(v != cur); typename imm::map<version, dep>::node found = s.get_forbidden_versions().lookup(v); @@ -1807,11 +1807,11 @@ private: action a2 = act; - assert(found_act.ver == act.ver); + eassert(found_act.ver == act.ver); if(a2.from_dep_source) { if(found_act.from_dep_source) - assert(a2.d == found_act.d); + eassert(a2.d == found_act.d); else a2.from_dep_source = false; @@ -1959,7 +1959,7 @@ private: if(ci->first != v.get_package()) insert_conflictor(conflict, ci->second); else - assert(ci->second.ver == v); + eassert(ci->second.ver == v); } } } @@ -1990,7 +1990,7 @@ private: insert_conflictor(conflict, action(source, d, false, -1)); else { - assert(source == source.get_package().current_version()); + eassert(source == source.get_package().current_version()); for(typename package::version_iterator vi = source.get_package().versions_begin(); !vi.end(); ++vi) @@ -2019,7 +2019,7 @@ private: // forcings are performed ASAP. solution curr = s; - assert(!s.get_broken().empty()); + eassert(!s.get_broken().empty()); // This loop attempts to generate all the successors of a // solution. However, if a "forced" dependency arises, it @@ -2111,7 +2111,7 @@ private: generate_successors(curr, *bi, conflict, real_generator(v)); - assert(v.size() == 1); + eassert(v.size() == 1); curr = v.back(); done = false; @@ -2273,7 +2273,7 @@ public: */ void set_version_score(const version &ver, int score) { - assert(ver.get_id()<universe.get_version_count()); + eassert(ver.get_id()<universe.get_version_count()); weights.version_scores[ver.get_id()]=score; } @@ -2282,14 +2282,14 @@ public: */ void add_version_score(const version &ver, int score) { - assert(ver.get_id()<universe.get_version_count()); + eassert(ver.get_id()<universe.get_version_count()); weights.version_scores[ver.get_id()]+=score; } /** \return the score of the version ver. */ int get_version_score(const version &ver) { - assert(ver.get_id()<universe.get_version_count()); + eassert(ver.get_id()<universe.get_version_count()); return weights.version_scores[ver.get_id()]; } @@ -2375,7 +2375,7 @@ public: /** Harden the given dependency. */ void harden(const dep &d, undo_group *undo = NULL) { - assert(d.is_soft()); + eassert(d.is_soft()); std::pair<typename std::set<dep>::const_iterator, bool> insert_result = user_hardened.insert(d); @@ -2706,7 +2706,7 @@ public: if(max_steps==0) throw NoMoreTime(); - assert(open.empty()); + eassert(open.empty()); finished=true; diff --git a/src/generic/problemresolver/solution.h b/src/generic/problemresolver/solution.h index e72f4518..207d6d74 100644 --- a/src/generic/problemresolver/solution.h +++ b/src/generic/problemresolver/solution.h @@ -181,7 +181,7 @@ private: public: void incref() const {++refcount;} - void decref() const {assert(refcount>0); if(--refcount==0) delete this;} + void decref() const {eassert(refcount>0); if(--refcount==0) delete this;} /** Construct a new solution_rep directly. */ solution_rep(const imm::map<package, action> &_actions, @@ -347,7 +347,7 @@ public: { const dep &d = *ui; - assert(broken_deps.contains(d)); + eassert(broken_deps.contains(d)); broken_deps.erase(d); unresolved_soft_deps.insert(d); } @@ -355,8 +355,8 @@ public: for(a_iter ai = abegin; ai != aend; ++ai) { const action &a = *ai; - assert(!actions.domain_contains(a.ver.get_package())); - assert(a.ver != a.ver.get_package().current_version()); + eassert(!actions.domain_contains(a.ver.get_package())); + eassert(a.ver != a.ver.get_package().current_version()); actions.put(a.ver.get_package(), a); diff --git a/src/generic/problemresolver/test.cc b/src/generic/problemresolver/test.cc index 48f1a460..e01e1c43 100644 --- a/src/generic/problemresolver/test.cc +++ b/src/generic/problemresolver/test.cc @@ -30,7 +30,7 @@ #include <map> #include <vector> -#include <assert.h> +#include <generic/util/eassert.h> using namespace std; diff --git a/src/generic/util/immset.h b/src/generic/util/immset.h index 74fc14ae..4d731165 100644 --- a/src/generic/util/immset.h +++ b/src/generic/util/immset.h @@ -28,7 +28,7 @@ #ifndef IMMSET_H #define IMMSET_H -#include <assert.h> +#include <generic/util/eassert.h> #include <iostream> #include <vector> @@ -99,14 +99,14 @@ namespace imm void incref() const { - assert(refcount>0); + eassert(refcount>0); ++refcount; } void decref() const { - assert(refcount>0); + eassert(refcount>0); --refcount; if(refcount == 0) @@ -442,7 +442,7 @@ namespace imm const_iterator &operator++() { - assert(!path.empty()); + eassert(!path.empty()); if(!path.back().first) { diff --git a/src/generic/util/temp.h b/src/generic/util/temp.h index 1b3b14f5..b1e1f2a1 100644 --- a/src/generic/util/temp.h +++ b/src/generic/util/temp.h @@ -25,6 +25,7 @@ #include <string> +#include "eassert.h" #include "exception.h" #include "threads.h" @@ -172,7 +173,7 @@ namespace temp { threads::mutex::lock l(m); - assert(refcount > 0); + eassert(refcount > 0); --refcount; if(refcount == 0) @@ -323,7 +324,7 @@ namespace temp { threads::mutex::lock l(m); - assert(refcount > 0); + eassert(refcount > 0); --refcount; if(refcount == 0) diff --git a/src/generic/util/undo.cc b/src/generic/util/undo.cc index 1c242ecb..b846a6df 100644 --- a/src/generic/util/undo.cc +++ b/src/generic/util/undo.cc @@ -6,7 +6,7 @@ #include "undo.h" -#include <assert.h> +#include <eassert.h> using namespace std; @@ -34,15 +34,15 @@ void undo_list::clear_items() floors.push_back(0); - assert(items.size()==0); - assert(floors.size()==1); + eassert(items.size()==0); + eassert(floors.size()==1); } void undo_list::collapse_to(unsigned int prev_size) { if(items.size()>prev_size && prev_size>=0) { - assert(prev_size>=floors.back()); + eassert(prev_size>=floors.back()); undo_group *new_item=new undo_group; @@ -60,7 +60,7 @@ void undo_list::revert_to(unsigned int prev_size) { if(prev_size>=0) { - assert(prev_size>=floors.back()); + eassert(prev_size>=floors.back()); while(items.size()>prev_size) undo(); @@ -69,7 +69,7 @@ void undo_list::revert_to(unsigned int prev_size) void undo_list::push_floor(unsigned int floor) { - assert(floor<=items.size()); + eassert(floor<=items.size()); floors.push_back(floor); } diff --git a/src/generic/util/util.cc b/src/generic/util/util.cc index 612b91d8..5f505403 100644 --- a/src/generic/util/util.cc +++ b/src/generic/util/util.cc @@ -28,6 +28,8 @@ #include <time.h> #include <unistd.h> +#include "eassert.h" + using namespace std; void stripws(string &s) @@ -72,7 +74,7 @@ string vssprintf(const char *format, va_list ap) int amt2 = vsnprintf(buf2, initbufsize, format, ap); - assert(amt2 < amt+1); + eassert(amt2 < amt+1); string rval(buf2, amt2); @@ -106,7 +108,7 @@ wstring vswsprintf(const wchar_t *format, va_list ap) int amt2 = vswprintf(buf2, initbufsize, format, ap); - assert(amt2 < amt+1); + eassert(amt2 < amt+1); wstring rval(buf2, amt2); diff --git a/src/load_grouppolicy.cc b/src/load_grouppolicy.cc index 8124af53..b5c07ed4 100644 --- a/src/load_grouppolicy.cc +++ b/src/load_grouppolicy.cc @@ -297,7 +297,7 @@ public: else if(!rval->terminal()) rval = auto_ptr<group_policy_parse_node>(new group_policy_pair_node(rval.release(), new group_policy_end_node)); - assert(rval->terminal()); + eassert(rval->terminal()); return rval.release(); } }; @@ -450,7 +450,7 @@ public: string(begin, end).c_str()); else if(begin != end && *begin != ')') { - assert(*begin == ','); + eassert(*begin == ','); throw GroupParseException(_("Exactly one filter must be provided as an argument to a filter policy")); } else @@ -610,7 +610,7 @@ class pattern_policy_parser : public group_policy_parser { ++begin; - assert(begin != end && *begin == '>'); + eassert(begin != end && *begin == '>'); ++begin; @@ -639,7 +639,7 @@ class pattern_policy_parser : public group_policy_parser throw GroupParseException(_("Unmatched '(' in pattern grouping policy")); else { - assert(*begin == ')'); + eassert(*begin == ')'); ++begin; } @@ -694,7 +694,7 @@ pkg_grouppolicy_factory *parse_grouppolicy(string s) { auto_ptr<group_policy_parse_node> node(list_policy_parser(parse_types).parse(begin, s.end())); - assert(begin == s.end()); + eassert(begin == s.end()); pkg_grouppolicy_factory *rval = node->instantiate(NULL); diff --git a/src/mine/board.cc b/src/mine/board.cc index 4e982c8b..362f7f38 100644 --- a/src/mine/board.cc +++ b/src/mine/board.cc @@ -43,7 +43,7 @@ void mine_board::init_board(int _width, int _height, int _mines) } starttime=time(0); - assert(mines==_mines); + eassert(mines==_mines); } void mine_board::seed_square(int x, int y) @@ -53,7 +53,7 @@ void mine_board::seed_square(int x, int y) // Anyway, I don't think this will be a speed bottleneck, so a sloppy version // is probably fine { - assert(!get_entry(x, y).contains_mine); + eassert(!get_entry(x, y).contains_mine); for(int i=x-1; i<=x+1; i++) if(i>=0 && i<width) for(int j=y-1; j<=y+1; j++) diff --git a/src/mine/board.h b/src/mine/board.h index c8d9f0e5..ca59844e 100644 --- a/src/mine/board.h +++ b/src/mine/board.h @@ -10,7 +10,7 @@ #include <string> #include <iostream> -#include <assert.h> +#include <generic/util/eassert.h> #include <time.h> class mine_board @@ -136,8 +136,8 @@ public: int get_width() {return width;} int get_height() {return height;} game_state get_state() {return state;} - int get_minex() {assert(state==lost); return minex;} - int get_miney() {assert(state==lost); return miney;} + int get_minex() {eassert(state==lost); return minex;} + int get_miney() {eassert(state==lost); return miney;} double get_duration() { if(state==playing) diff --git a/src/mine/cmine.cc b/src/mine/cmine.cc index ca933e3d..ad0e122c 100644 --- a/src/mine/cmine.cc +++ b/src/mine/cmine.cc @@ -134,7 +134,7 @@ void cmine::paint_header(const style &st) unsigned int loc=0; while(headerw < width) { - assert(buf[loc]!=0); + eassert(buf[loc]!=0); wchar_t wch=buf[loc]; header+=buf; @@ -694,8 +694,8 @@ void cmine::paint_square(int x, int y, const style &st) int width,height; getmaxyx(height, width); - assert(x>=0 && x<board->get_width()); - assert(y>=0 && y<board->get_height()); + eassert(x>=0 && x<board->get_width()); + eassert(y>=0 && y<board->get_height()); int screenx=basex+1+x,screeny=(basey+1)+1+y; diff --git a/src/pkg_grouppolicy.cc b/src/pkg_grouppolicy.cc index 25d580cb..de0838d4 100644 --- a/src/pkg_grouppolicy.cc +++ b/src/pkg_grouppolicy.cc @@ -573,7 +573,7 @@ public: void add_package(const pkgCache::PkgIterator &pkg, pkg_subtree *root) { - assert(pkg.Name()); + eassert(pkg.Name()); char firstchar=toupper(pkg.Name()[0]); @@ -926,7 +926,7 @@ void pkg_grouppolicy_task::add_package(const pkgCache::PkgIterator &pkg, { list<string> *tasks=get_tasks(pkg); - assert(tasks); + eassert(tasks); chain->add_package(pkg, root); @@ -1310,7 +1310,7 @@ public: { if(untagged_tree == NULL) { - assert(untagged_policy == NULL); + eassert(untagged_policy == NULL); untagged_tree = new pkg_subtree(transcode(_("TAGLESS PACKAGES")), transcode(_("\n These packages have not yet been classified in debtags.")), @@ -1328,7 +1328,7 @@ public: { tag::const_iterator j = ti->begin(); - assert(j != ti->end()); + eassert(j != ti->end()); string thisfacet = *j; diff --git a/src/pkg_item.cc b/src/pkg_item.cc index ce200efc..b3b9091a 100644 --- a/src/pkg_item.cc +++ b/src/pkg_item.cc @@ -74,7 +74,7 @@ static void try_delete_essential(wstring s, static void confirm_delete_essential(const pkgCache::PkgIterator &pkg, bool purge) { - assert((pkg->Flags&pkgCache::Flag::Essential)==pkgCache::Flag::Essential || + eassert((pkg->Flags&pkgCache::Flag::Essential)==pkgCache::Flag::Essential || (pkg->Flags&pkgCache::Flag::Important)==pkgCache::Flag::Important); fragment *f=wrapbox(fragf(_("%s is an essential package!%n%nAre you sure you want to remove it?%nType '%s' if you are."), pkg.Name(), _(confirm_str))); diff --git a/src/pkg_view.cc b/src/pkg_view.cc index c9900ded..1bd6f76f 100644 --- a/src/pkg_view.cc +++ b/src/pkg_view.cc @@ -402,7 +402,7 @@ vs_widget_ref make_package_view(list<package_view_item> &format, vs_table_ref rval=vs_table::create(); - assert(mainwidget.valid()); + eassert(mainwidget.valid()); for(list<package_view_item>::iterator i=format.begin(); i!=format.end(); diff --git a/src/solution_fragment.cc b/src/solution_fragment.cc index 0c5e7d2e..b50b5493 100644 --- a/src/solution_fragment.cc +++ b/src/solution_fragment.cc @@ -65,7 +65,7 @@ string dep_targets(const pkgCache::DepIterator &start) bool is_first = true; - assert(!start.end()); + eassert(!start.end()); for(pkgCache::DepIterator d = start; !d.end(); ++d) { @@ -185,7 +185,7 @@ fragment *solution_fragment(const aptitude_solution &sol) // The versions shouldn't be equal -- otherwise // something is majorly wrong. - // assert(cmp!=0); + // eassert(cmp!=0); // // The above is not true: consider, eg, the case of a // locally compiled package and a standard package. diff --git a/src/solution_item.cc b/src/solution_item.cc index 3e79a42b..aa0504e8 100644 --- a/src/solution_item.cc +++ b/src/solution_item.cc @@ -65,7 +65,7 @@ action_type analyze_action(const aptitude_universe::version &ver) // The versions shouldn't be equal -- otherwise // something is majorly wrong. - // assert(cmp!=0); + // eassert(cmp!=0); // // The above is not true: consider, eg, the case of a // locally compiled package and a standard package. @@ -208,14 +208,14 @@ bool solution_item::resolver_toggle_rejected_enabled() bool solution_act_item::is_rejected() { - assert(resman->resolver_exists()); + eassert(resman->resolver_exists()); return resman->is_rejected(ver); } bool solution_act_item::is_mandatory() { - assert(resman->resolver_exists()); + eassert(resman->resolver_exists()); return resman->is_mandatory(ver); } @@ -349,7 +349,7 @@ void solution_act_item::paint(vs_tree *win, int y, bool hierarchical, const styl fragment_contents c = f->layout(width-x, width-x, st); delete f; - assert(c.size() < 2); + eassert(c.size() < 2); if(c.size() > 0) { const fragment_line &l = c.front(); @@ -363,7 +363,7 @@ static bool do_read_only_permission() static void do_read_only_fail() { - assert(active_download); + eassert(active_download); show_message(_("You may not modify the state of any package while a download is underway.")); } @@ -1133,7 +1133,7 @@ static void do_show_preview() { if(!active_preview_tree.valid()) { - assert(!active_preview.valid()); + eassert(!active_preview.valid()); pkg_grouppolicy_factory *grp=NULL; std::string grpstr; @@ -1181,7 +1181,7 @@ static void do_show_preview() } else { - assert(active_preview.valid()); + eassert(active_preview.valid()); active_preview->show(); } } @@ -1207,8 +1207,8 @@ static void auto_fix_broken() try { - assert(resman != NULL); - assert(resman->resolver_exists()); + eassert(resman != NULL); + eassert(resman->resolver_exists()); aptitude_solution sol = resman->get_solution(resman->get_selected_solution(), 0); diff --git a/src/vs_progress.cc b/src/vs_progress.cc index 50b4d9ee..d25fa600 100644 --- a/src/vs_progress.cc +++ b/src/vs_progress.cc @@ -37,7 +37,7 @@ void vs_progress::paint(const style &st) if(!Op.empty()) { - assert(Percent>=0 && Percent<=100); + eassert(Percent>=0 && Percent<=100); barsize=int(Percent*width/100.0); snprintf(percent_string, 50, ": %i%%", int(Percent)); diff --git a/src/vscreen/columnify.cc b/src/vscreen/columnify.cc index 4e9e7c0f..79dab642 100644 --- a/src/vscreen/columnify.cc +++ b/src/vscreen/columnify.cc @@ -41,7 +41,7 @@ wstring columnify(const layout &format, int width) i!=format.end(); ++i, ++colnum) { - assert(colnum<format.size()); + eassert(colnum<format.size()); final_info.push_back(column(i->info, i->width, i->expand, i->shrink)); } diff --git a/src/vscreen/columnify.h b/src/vscreen/columnify.h index ffd0cf64..10cb8bf9 100644 --- a/src/vscreen/columnify.h +++ b/src/vscreen/columnify.h @@ -35,7 +35,7 @@ #include <list> #include <string> -#include <assert.h> +#include <generic/util/eassert.h> struct column_disposition { @@ -59,7 +59,7 @@ struct column column(const column_disposition &_info, int _width, bool _expand, bool _shrink) :info(_info), width(_width), expand(_expand), shrink(_shrink) { - assert(_width>=0); + eassert(_width>=0); } }; diff --git a/src/vscreen/config/colors.cc b/src/vscreen/config/colors.cc index 5a0f9c80..5e64e68a 100644 --- a/src/vscreen/config/colors.cc +++ b/src/vscreen/config/colors.cc @@ -56,7 +56,7 @@ int get_color_pair(short fg, short bg) return 0; else { - assert(fg >= 0 && bg >= -1 && fg < COLORS && bg < COLORS); + eassert(fg >= 0 && bg >= -1 && fg < COLORS && bg < COLORS); if(bg == -1) return fg * COLORS + fg; diff --git a/src/vscreen/config/column_definition.cc b/src/vscreen/config/column_definition.cc index 11577655..c2d2d964 100644 --- a/src/vscreen/config/column_definition.cc +++ b/src/vscreen/config/column_definition.cc @@ -250,7 +250,7 @@ wstring column_generator::layout_columns(unsigned int width, } else { - assert(j->type == column_definition::COLUMN_GENERATED || + eassert(j->type == column_definition::COLUMN_GENERATED || j->type == column_definition::COLUMN_PARAM); if(j->type == column_definition::COLUMN_GENERATED) diff --git a/src/vscreen/config/column_definition.h b/src/vscreen/config/column_definition.h index b2984c7d..6741a347 100644 --- a/src/vscreen/config/column_definition.h +++ b/src/vscreen/config/column_definition.h @@ -41,7 +41,7 @@ #include <list> #include <string> -#include <assert.h> +#include <generic/util/eassert.h> #include <vscreen/columnify.h> @@ -107,7 +107,7 @@ struct column_definition :type(_type), ival(_ival), width(_width), expand(_expand), shrink(_shrink), dynamic_size(_dynamic_size) { - assert(_width>=0); + eassert(_width>=0); } }; diff --git a/src/vscreen/config/style.h b/src/vscreen/config/style.h index db51b440..10c539d1 100644 --- a/src/vscreen/config/style.h +++ b/src/vscreen/config/style.h @@ -28,7 +28,7 @@ #include "colors.h" -#include <assert.h> +#include <generic/util/eassert.h> /** A "style" is a setting to be applied to a display element (widget, * text, etc). This means color (foreground and background) and diff --git a/src/vscreen/curses++.cc b/src/vscreen/curses++.cc index 4e5cd57f..7b9fdc15 100644 --- a/src/vscreen/curses++.cc +++ b/src/vscreen/curses++.cc @@ -237,9 +237,9 @@ void resize() { resize_term(w.ws_row,w.ws_col); rootwin=newwin(w.ws_row, w.ws_col, 0, 0); - assert(rootwin); - //assert(rootwin.getmaxy()==w.ws_row); - //assert(rootwin.getmaxx()==w.ws_col); + eassert(rootwin); + //eassert(rootwin.getmaxy()==w.ws_row); + //eassert(rootwin.getmaxx()==w.ws_col); return; } else diff --git a/src/vscreen/curses++.h b/src/vscreen/curses++.h index cb2dd529..3969ac8a 100644 --- a/src/vscreen/curses++.h +++ b/src/vscreen/curses++.h @@ -25,7 +25,7 @@ #include <string> #include <ncursesw/curses.h> -#include <assert.h> +#include <generic/util/eassert.h> // For isspace #include <ctype.h> @@ -374,7 +374,7 @@ class cwindow ~cwindow_master() { - assert(refs==0); + eassert(refs==0); if(win) delwin(win); diff --git a/src/vscreen/fragment.cc b/src/vscreen/fragment.cc index b64ab6d6..c7afa0f9 100644 --- a/src/vscreen/fragment.cc +++ b/src/vscreen/fragment.cc @@ -620,7 +620,7 @@ public: // As far as I know, this is valid everywhere...but it would be // rather tricky to write this algorithm without making this // assumption. - assert(wcwidth(L' ')==1); + eassert(wcwidth(L' ')==1); if(restw==0) return fragment_contents(); @@ -1054,7 +1054,7 @@ public: fragment_contents layout(size_t firstw, size_t restw, const style &st) { - assert(firstw == restw); + eassert(firstw == restw); vector<size_t> widths(columns.size()); update_widths(widths, restw); @@ -1120,7 +1120,7 @@ public: size_t calc_max_width(size_t first_indent, size_t rest_indent) const { - assert(first_indent == rest_indent); + eassert(first_indent == rest_indent); size_t rval = 0; @@ -1151,7 +1151,7 @@ public: size_t calc_trailing_width(size_t first_indent, size_t rest_indent) const { - assert(first_indent == rest_indent); + eassert(first_indent == rest_indent); return rest_indent; } @@ -1464,7 +1464,7 @@ fragment *fragf(const char *format, ...) break; case 'F': // should have been verified above. - assert(arguments[argcount].format=='F'); + eassert(arguments[argcount].format=='F'); if(!curstr.empty()) { @@ -1476,7 +1476,7 @@ fragment *fragf(const char *format, ...) break; case 's': // should have been verified above. - assert(arguments[argcount].format=='s'); + eassert(arguments[argcount].format=='s'); if(islong) curstr+=transcode(arguments[argcount].ls); @@ -1485,7 +1485,7 @@ fragment *fragf(const char *format, ...) ++argcount; break; case 'S': - assert(arguments[argcount].format=='S'); + eassert(arguments[argcount].format=='S'); if(!curstr.empty()) { @@ -1511,7 +1511,7 @@ fragment *fragf(const char *format, ...) int pos=strtol(nextpercent+1, &endptr, 10)-1; - assert(arguments[pos].format==*(endptr+1)); + eassert(arguments[pos].format==*(endptr+1)); switch(*(endptr+1)) { diff --git a/src/vscreen/ref_ptr.h b/src/vscreen/ref_ptr.h index c282a83b..01ec32c6 100644 --- a/src/vscreen/ref_ptr.h +++ b/src/vscreen/ref_ptr.h @@ -9,7 +9,7 @@ #include <sigc++/reference_wrapper.h> -#include <assert.h> +#include <generic/util/eassert.h> template<class T> class ref_ptr @@ -65,7 +65,7 @@ public: const sigc::reference_wrapper<T> weak_ref() const { - assert(ref != 0); + eassert(ref != 0); return sigc::ref(*ref); } diff --git a/src/vscreen/transcode.cc b/src/vscreen/transcode.cc index e92b7f09..2fd1e7f5 100644 --- a/src/vscreen/transcode.cc +++ b/src/vscreen/transcode.cc @@ -19,7 +19,7 @@ #include "transcode.h" -#include <assert.h> +#include <generic/util/eassert.h> #include <errno.h> #include <iconv.h> @@ -130,7 +130,7 @@ static bool transcode_buffer(iconv_t &state, while(result == (size_t)(-1)) { - assert(errno == E2BIG); + eassert(errno == E2BIG); size_t idx = outbufcur-outbuf; outremaining += outbufsize; @@ -177,13 +177,13 @@ static bool transcode_buffer(iconv_t &state, &errbufsize, &outbufcur, &outremaining); } - assert(errbufsize == 0); + eassert(errbufsize == 0); // Return again to initial shift state result = iconv(state2, NULL, NULL, &outbufcur, &outremaining); while(result == (size_t)(-1)) { - assert(errno == E2BIG); + eassert(errno == E2BIG); size_t idx = outbufcur-outbuf; outremaining += outbufsize; @@ -213,7 +213,7 @@ static bool transcode_buffer(iconv_t &state, // if this fails, my understanding of iconv is wrong: the // iconv docs say that if it doesn't fail, then the whole // input sequence was converted. - assert(inremaining == 0); + eassert(inremaining == 0); } decoded=outbufsize-outremaining; diff --git a/src/vscreen/vs_bin.cc b/src/vscreen/vs_bin.cc index 0bc3777a..ab96150a 100644 --- a/src/vscreen/vs_bin.cc +++ b/src/vscreen/vs_bin.cc @@ -63,7 +63,7 @@ void vs_bin::destroy() if(subwidget.valid()) subwidget->destroy(); - assert(!subwidget.valid()); + eassert(!subwidget.valid()); vs_container::destroy(); } @@ -72,8 +72,8 @@ void vs_bin::add_widget(const vs_widget_ref &w) { vs_widget_ref tmpref(this); - assert(!subwidget.valid()); - assert(w.valid()); + eassert(!subwidget.valid()); + eassert(w.valid()); set_subwidget(w); @@ -89,7 +89,7 @@ void vs_bin::rem_widget(const vs_widget_ref &w) { vs_widget_ref tmpref(this); - assert(w == subwidget); + eassert(w == subwidget); set_subwidget(NULL); if(get_visible()) @@ -113,7 +113,7 @@ void vs_bin::show_widget(const vs_widget_ref &w) { vs_widget_ref tmpref(this); - assert(w==subwidget); + eassert(w==subwidget); show(); } @@ -129,7 +129,7 @@ void vs_bin::hide_widget(const vs_widget_ref &w) { vs_widget_ref tmpref(this); - assert(w==subwidget); + eassert(w==subwidget); hide(); } diff --git a/src/vscreen/vs_editline.cc b/src/vscreen/vs_editline.cc index a49e169b..09572bc3 100644 --- a/src/vscreen/vs_editline.cc +++ b/src/vscreen/vs_editline.cc @@ -417,7 +417,7 @@ void vs_editline::dispatch_mouse(short id, int x, int y, int z, mmask_t bstate) void vs_editline::add_to_history(std::wstring s, history_list *lst) { - assert(lst); + eassert(lst); if(lst->empty() || lst->back()!=s) lst->push_back(s); diff --git a/src/vscreen/vs_menu.cc b/src/vscreen/vs_menu.cc index 2b8c0a00..65cd93fa 100644 --- a/src/vscreen/vs_menu.cc +++ b/src/vscreen/vs_menu.cc @@ -112,7 +112,7 @@ vs_menu::vs_menu(int x, int y, int w, vs_menu_info *inf) switch(inf->item_type) { case vs_menu_info::VS_MENU_ITEM: - assert(inf->item_name!=NULL); + eassert(inf->item_name!=NULL); { vs_menu_item *newitem=new vs_menu_item(transcode(inf->item_name), @@ -129,7 +129,7 @@ vs_menu::vs_menu(int x, int y, int w, vs_menu_info *inf) } break; case vs_menu_info::VS_MENU_SEPARATOR: - assert(inf->item_name==NULL); + eassert(inf->item_name==NULL); append_item(NULL); break; @@ -168,7 +168,7 @@ void vs_menu::remove_item(vs_menu_item *item) while(idx<items.size() && items[idx]!=item) ++idx; - assert(idx<items.size()); + eassert(idx<items.size()); for(itemlist::size_type newidx=idx; newidx<items.size()-1; ++newidx) items[newidx]=items[newidx+1]; diff --git a/src/vscreen/vs_menubar.cc b/src/vscreen/vs_menubar.cc index efd8a039..a23192d5 100644 --- a/src/vscreen/vs_menubar.cc +++ b/src/vscreen/vs_menubar.cc @@ -43,9 +43,9 @@ vs_menubar::vs_menubar(bool _always_visible) vs_menubar::~vs_menubar() { - assert(!subwidget.valid()); - assert(items.empty()); - assert(active_menus.empty()); + eassert(!subwidget.valid()); + eassert(items.empty()); + eassert(active_menus.empty()); } vs_widget_ref vs_menubar::get_active_widget() @@ -59,7 +59,7 @@ void vs_menubar::destroy() if(subwidget.valid()) subwidget->destroy(); - assert(!subwidget.valid()); + eassert(!subwidget.valid()); // ew. You see, we need to individually destroy the subwidgets, but // doing so will cause them to be removed, so we can't iterate over @@ -70,8 +70,8 @@ void vs_menubar::destroy() i != curr_items.end(); ++i) i->menu->destroy(); - assert(items.empty()); - assert(active_menus.empty()); + eassert(items.empty()); + eassert(active_menus.empty()); vs_container::destroy(); } @@ -254,7 +254,7 @@ void vs_menubar::add_widget(const vs_widget_ref &w) { vs_widget_ref tmpref(this); - assert(!subwidget.valid()); + eassert(!subwidget.valid()); set_subwidget(w); } @@ -267,7 +267,7 @@ void vs_menubar::rem_widget(const vs_widget_ref &w) set_subwidget(NULL); else { - assert(w->get_owner().unsafe_get_ref() == this); + eassert(w->get_owner().unsafe_get_ref() == this); bool found = false; @@ -286,7 +286,7 @@ void vs_menubar::rem_widget(const vs_widget_ref &w) } } - assert(found); + eassert(found); active_menus.remove(w2); @@ -431,7 +431,7 @@ void vs_menubar::show_menu(const vs_menu_ref &w) for(activemenulist::iterator i=active_menus.begin(); i!=active_menus.end(); i++) - assert(w != *i); + eassert(w != *i); if(old_focus.valid()) old_focus->unfocussed(); diff --git a/src/vscreen/vs_minibuf_win.cc b/src/vscreen/vs_minibuf_win.cc index 2f8b1dcf..8576a601 100644 --- a/src/vscreen/vs_minibuf_win.cc +++ b/src/vscreen/vs_minibuf_win.cc @@ -55,13 +55,13 @@ void vs_minibuf_win::destroy() if(main_widget.valid()) main_widget->destroy(); - assert(!main_widget.valid()); + eassert(!main_widget.valid()); header->destroy(); status->destroy(); - assert(!header.valid()); - assert(!status.valid()); + eassert(!header.valid()); + eassert(!status.valid()); vs_container::destroy(); } @@ -177,7 +177,7 @@ void vs_minibuf_win::rem_widget(const vs_widget_ref &widget) { vs_widget_ref tmpref(this); - assert(widget.valid()); + eassert(widget.valid()); if(widget == header) { diff --git a/src/vscreen/vs_multiplex.cc b/src/vscreen/vs_multiplex.cc index 5860b054..da18f70c 100644 --- a/src/vscreen/vs_multiplex.cc +++ b/src/vscreen/vs_multiplex.cc @@ -25,7 +25,7 @@ #include <sigc++/adaptors/bind.h> #include <sigc++/functors/mem_fun.h> -#include <assert.h> +#include <generic/util/eassert.h> using namespace std; @@ -40,7 +40,7 @@ vs_multiplex::vs_multiplex(bool _show_tabs) vs_multiplex::~vs_multiplex() { - assert(children.empty()); + eassert(children.empty()); } void vs_multiplex::destroy() @@ -132,7 +132,7 @@ void vs_multiplex::paint(const style &st) if(i->w->get_visible()) ++visible_children; - assert(visible_children>0); + eassert(visible_children>0); int remaining_w=getmaxx(); move(0, 0); @@ -181,7 +181,7 @@ void vs_multiplex::paint(const style &st) thisw-=wcwidth(L' '); } } - assert(visible_children == 0); + eassert(visible_children == 0); } if(visible_child!=children.end()) @@ -204,7 +204,7 @@ void vs_multiplex::dispatch_mouse(short id, int x, int y, int z, if(i->w->get_visible()) ++visible_children; - assert(visible_children>0); + eassert(visible_children>0); int startx=0; int remaining_w=getmaxx(); @@ -227,8 +227,8 @@ void vs_multiplex::dispatch_mouse(short id, int x, int y, int z, startx+=thisw; } - assert(x<0 || x>=getmaxx()); - assert(visible_children == 0); + eassert(x<0 || x>=getmaxx()); + eassert(visible_children == 0); } else if(visible_child!=children.end()) visible_child->w->dispatch_mouse(id, @@ -267,7 +267,7 @@ void vs_multiplex::show_widget(const vs_widget_ref &w) { vs_widget_ref tmpref(this); - assert(!children.empty()); + eassert(!children.empty()); list<child_info>::iterator new_visible=visible_child; @@ -307,7 +307,7 @@ void vs_multiplex::hide_widget(const vs_widget_ref &w) { vs_widget_ref tmpref(this); - assert(!children.empty()); + eassert(!children.empty()); if(visible_child!=children.end() && visible_child->w==w) { @@ -350,7 +350,7 @@ void vs_multiplex::hide_widget(const vs_widget_ref &w) // Since we just hid the previously-visible child, this MUST be // the case. - assert(visible_child != old_visible); + eassert(visible_child != old_visible); cycled(); vscreen_queuelayout(); @@ -383,7 +383,7 @@ void vs_multiplex::rem_widget(const vs_widget_ref &w) { if(i->w==w) { - assert(w->get_owner().unsafe_get_ref() == this); + eassert(w->get_owner().unsafe_get_ref() == this); w->set_owner(NULL); diff --git a/src/vscreen/vs_multiplex.h b/src/vscreen/vs_multiplex.h index 77f70041..e5d755df 100644 --- a/src/vscreen/vs_multiplex.h +++ b/src/vscreen/vs_multiplex.h @@ -30,7 +30,7 @@ #include "curses++.h" #include "vs_passthrough.h" -#include <assert.h> +#include <generic/util/eassert.h> #include <list> #include <string> diff --git a/src/vscreen/vs_pager.cc b/src/vscreen/vs_pager.cc index c1445d24..af135db1 100644 --- a/src/vscreen/vs_pager.cc +++ b/src/vscreen/vs_pager.cc @@ -317,7 +317,7 @@ void vs_pager::paint(const style &st) wchar_t ch=s[curr]; // No nonprintables other than \t should appear // (set_text screens them out) - assert(iswprint(ch)); + eassert(iswprint(ch)); if(x>=first_column) { diff --git a/src/vscreen/vs_radiogroup.cc b/src/vscreen/vs_radiogroup.cc index 92ef2268..25af709e 100644 --- a/src/vscreen/vs_radiogroup.cc +++ b/src/vscreen/vs_radiogroup.cc @@ -28,7 +28,7 @@ int vs_radiogroup::get_selected() void vs_radiogroup::button_pressed(itemlist::size_type index) { - assert(index<items.size()); + eassert(index<items.size()); if(selected!=items.max_size()) items[selected].b->set_checked(false); @@ -43,10 +43,10 @@ void vs_radiogroup::button_pressed(itemlist::size_type index) void vs_radiogroup::add_button(const vs_togglebutton_ref &b, int id) { - assert(id>=0); + eassert(id>=0); for(itemlist::iterator i=items.begin(); i!=items.end(); i++) - assert(i->b!=b); + eassert(i->b!=b); items.push_back(item(b, id, b->destroyed.connect(sigc::bind(sigc::mem_fun(*this, &vs_radiogroup::rem_button_bare), b.weak_ref())), @@ -70,7 +70,7 @@ void vs_radiogroup::rem_button(const vs_togglebutton_ref &b) else if(i+1<items.size()) button_pressed(i+1); else - assert(items.size() == 1); + eassert(items.size() == 1); } if(i==items.size()-1) diff --git a/src/vscreen/vs_stacked.cc b/src/vscreen/vs_stacked.cc index 8bec6a43..c6e2418b 100644 --- a/src/vscreen/vs_stacked.cc +++ b/src/vscreen/vs_stacked.cc @@ -14,7 +14,7 @@ vs_stacked::vs_stacked(int w, int h) vs_stacked::~vs_stacked() { - assert(children.empty()); + eassert(children.empty()); } void vs_stacked::destroy() diff --git a/src/vscreen/vs_statuschoice.h b/src/vscreen/vs_statuschoice.h index 7829e337..5efd2c06 100644 --- a/src/vscreen/vs_statuschoice.h +++ b/src/vscreen/vs_statuschoice.h @@ -29,7 +29,7 @@ #define VS_STATUSCHOICE_H #include <string> -#include <assert.h> +#include <generic/util/eassert.h> #include "vscreen_widget.h" @@ -48,7 +48,7 @@ protected: vs_statuschoice(const std::wstring &_prompt, const std::wstring &_choices) :vscreen_widget(), prompt(_prompt), choices(_choices) { - assert(choices.size()>0); + eassert(choices.size()>0); } public: diff --git a/src/vscreen/vs_subtree.h b/src/vscreen/vs_subtree.h index 7477a6b1..933fc847 100644 --- a/src/vscreen/vs_subtree.h +++ b/src/vscreen/vs_subtree.h @@ -54,7 +54,7 @@ protected: { } - vs_treeitem *get_item() {assert(realitem!=parent_list->end()); return *realitem;} + vs_treeitem *get_item() {eassert(realitem!=parent_list->end()); return *realitem;} virtual void advance_next() {++realitem;} virtual void return_prev() {--realitem;} bool is_begin() {return realitem==parent_list->begin();} diff --git a/src/vscreen/vs_table.cc b/src/vscreen/vs_table.cc index e2ebcebe..52538f51 100644 --- a/src/vscreen/vs_table.cc +++ b/src/vscreen/vs_table.cc @@ -61,7 +61,7 @@ vs_table::vs_table() vs_table::~vs_table() { - assert(children.empty()); + eassert(children.empty()); } void vs_table::destroy() @@ -299,7 +299,7 @@ void vs_table::rem_widget(const vs_widget_ref &wBare) if(focus != children.end()) { - assert(focus != i); + eassert(focus != i); if(get_isfocussed()) focus->w->focussed(); @@ -331,7 +331,7 @@ void vs_table::focus_widget(const vs_widget_ref &w) { if(i!=focus) { - assert(i->w->get_visible() && i->w->focus_me()); + eassert(i->w->get_visible() && i->w->focus_me()); if(focus!=children.end() && get_isfocussed()) focus->w->unfocussed(); @@ -537,9 +537,9 @@ vs_table::childlist::iterator vs_table::find_best_focus(childlist::iterator star int dx, int dy) { - assert(start!=children.end()); - assert(dx==0 || dy==0); - assert(!(dx==dy)); + eassert(start!=children.end()); + eassert(dx==0 || dy==0); + eassert(!(dx==dy)); list<childlist::iterator> sorted_children; @@ -974,7 +974,7 @@ void vs_table::shrink_widths(vector<int> &col_sizes, int target_w) overflow-=amt; } - assert(overflow==0); + eassert(overflow==0); } #ifdef DEBUG_TABLES @@ -1273,7 +1273,7 @@ void vs_table::shrink_heights(vector<int> &row_sizes, int target_h) overflow-=amt; } - assert(overflow==0); + eassert(overflow==0); } #ifdef DEBUG_TABLES @@ -1331,8 +1331,8 @@ void vs_table::alloc_child_sizes(const vector<int> &col_sizes, for(int j=0; j<i->row_span; ++j) height+=row_sizes[j+i->row_start]; - assert(x+width<=getmaxx()); - assert(y+height<=getmaxy()); + eassert(x+width<=getmaxx()); + eassert(y+height<=getmaxy()); // If the widget can't be filled and it was allocated too much // space, make sure it's aligned in the space: diff --git a/src/vscreen/vs_tree.cc b/src/vscreen/vs_tree.cc index 6ebeb6ce..ed2b9db1 100644 --- a/src/vscreen/vs_tree.cc +++ b/src/vscreen/vs_tree.cc @@ -256,7 +256,7 @@ void vs_tree::set_selection(vs_treeiterator to) while(l < 1) { - assert(top != end); + eassert(top != end); if(hierarchical) --top; @@ -268,7 +268,7 @@ void vs_tree::set_selection(vs_treeiterator to) while(l > height) { - assert(top != end); + eassert(top != end); if(hierarchical) ++top; diff --git a/src/vscreen/vs_tree.h b/src/vscreen/vs_tree.h index 46acaca3..5ec6bcac 100644 --- a/src/vscreen/vs_tree.h +++ b/src/vscreen/vs_tree.h @@ -38,7 +38,7 @@ #include "vs_treeitem.h" #include <list> -#include <assert.h> +#include <generic/util/eassert.h> class keybindings; diff --git a/src/vscreen/vscreen.cc b/src/vscreen/vscreen.cc index 9e4068d5..05485965 100644 --- a/src/vscreen/vscreen.cc +++ b/src/vscreen/vscreen.cc @@ -50,7 +50,7 @@ #include <signal.h> -#include <assert.h> +#include <generic/util/eassert.h> #include <sys/time.h> #include <map> diff --git a/src/vscreen/vscreen_widget.cc b/src/vscreen/vscreen_widget.cc index 7070f20f..3589fe18 100644 --- a/src/vscreen/vscreen_widget.cc +++ b/src/vscreen/vscreen_widget.cc @@ -14,7 +14,7 @@ #include <config/colors.h> #include <config/keybindings.h> -#include <assert.h> +#include <generic/util/eassert.h> #ifdef HAVE_CONFIG_H #include <config.h> @@ -42,8 +42,8 @@ vscreen_widget::vscreen_widget() vscreen_widget::~vscreen_widget() { - assert(!owner); - assert(is_destroyed); + eassert(!owner); + eassert(is_destroyed); } void vscreen_widget::set_bg_style(const style &new_style) @@ -77,7 +77,7 @@ void vscreen_widget::set_owner_window(cwindow _win, int x, int y, int w, int h) win=NULL; else { - assert(!is_destroyed); + eassert(!is_destroyed); win=_win.derwin(geom.h, geom.w, @@ -118,13 +118,13 @@ int vscreen_widget::timeout(int msecs) void vscreen_widget::cleanup() { - assert(is_destroyed); + eassert(is_destroyed); delete this; } void vscreen_widget::destroy() { - assert(refcount > 0); + eassert(refcount > 0); if(is_destroyed) return; @@ -137,7 +137,7 @@ void vscreen_widget::destroy() if(owner) { owner->rem_widget(this); - assert(!win); + eassert(!win); } // This must be done after hide() and rem_widget(), because diff --git a/src/vscreen/vscreen_widget.h b/src/vscreen/vscreen_widget.h index 22e79041..f604263e 100644 --- a/src/vscreen/vscreen_widget.h +++ b/src/vscreen/vscreen_widget.h @@ -49,7 +49,7 @@ #include "config/style.h" #include "ref_ptr.h" -#include <assert.h> +#include <generic/util/eassert.h> class vs_container; class key; @@ -179,14 +179,14 @@ protected: public: void incref() { - assert(refcount > 0); + eassert(refcount > 0); ++refcount; } void decref() { - assert(refcount > 0); + eassert(refcount > 0); --refcount; if(refcount == 0) |