diff --git a/ChangeLog b/ChangeLog index 0848d410c..674d9d00f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-03-31 Alexandre Duret-Lutz + + Cosmetics. + + * src/sanity/style.test: Catch some binary operators not + delimited with spaces. + * src/tgbaalgos/bfssteps.cc, src/tgbaalgos/magic.cc, + src/tgbaalgos/reducerun.cc, src/tgbaalgos/se05.cc, + src/tgbaalgos/tau03.cc, src/tgbaalgos/tau03opt.cc: Fix these. + 2011-03-31 Alexandre Duret-Lutz Make state_explicit instances persistent objects. diff --git a/src/sanity/style.test b/src/sanity/style.test index 80a23a55c..7c87a921f 100755 --- a/src/sanity/style.test +++ b/src/sanity/style.test @@ -121,10 +121,16 @@ for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do grep ",[^ \t\"%']" $tmp && diag 'Space after coma.' - grep '[^ ]&&[^ ]' $tmp && + # The 'r' allows operator&& + grep '[^ r]&&[^ ]' $tmp && diag 'Space arround binary operators.' - grep '[^ ]||[^ ]' $tmp && + # The 'r' allows operator|| + grep '[^ r]||[^ ]' $tmp && + diag 'Space arround binary operators.' + + # The 'r' allows operator== + grep '[^ r][!<>=]=[^ ]' $tmp && diag 'Space arround binary operators.' grep '[ ]default:[^:].*;' $tmp && diff --git a/src/tgbaalgos/bfssteps.cc b/src/tgbaalgos/bfssteps.cc index 8ffe85283..056129c80 100644 --- a/src/tgbaalgos/bfssteps.cc +++ b/src/tgbaalgos/bfssteps.cc @@ -52,7 +52,7 @@ namespace spot break; std::map::const_iterator it = father.find(current.s); - assert(it!=father.end()); + assert(it != father.end()); current = it->second; } l.splice(l.end(), p); diff --git a/src/tgbaalgos/magic.cc b/src/tgbaalgos/magic.cc index 0a055aad6..bd4d4cbca 100644 --- a/src/tgbaalgos/magic.cc +++ b/src/tgbaalgos/magic.cc @@ -447,7 +447,7 @@ namespace spot } bool is_white() const { - return p==0; + return p == 0; } private: color *p; @@ -472,19 +472,19 @@ namespace spot color_ref get_color_ref(const state*& s) { hash_type::iterator it = h.find(s); - if (it==h.end()) + if (it == h.end()) return color_ref(0); - if (s!=it->first) + if (s != it->first) { s->destroy(); s = it->first; } - return color_ref(&(it->second)); + return color_ref(&it->second); } void add_new_state(const state* s, color c) { - assert(h.find(s)==h.end()); + assert(h.find(s) == h.end()); h.insert(std::make_pair(s, c)); } @@ -532,7 +532,7 @@ namespace spot } bool is_white() const { - return get_color()==WHITE; + return get_color() == WHITE; } private: unsigned char *base; diff --git a/src/tgbaalgos/reducerun.cc b/src/tgbaalgos/reducerun.cc index 9e652281d..e218af741 100644 --- a/src/tgbaalgos/reducerun.cc +++ b/src/tgbaalgos/reducerun.cc @@ -68,7 +68,7 @@ namespace spot filter(const state* s) { state_set::const_iterator i = seen.find(s); - if (i==seen.end()) + if (i == seen.end()) seen.insert(s); else { diff --git a/src/tgbaalgos/se05.cc b/src/tgbaalgos/se05.cc index 63048f0ab..13605aae9 100644 --- a/src/tgbaalgos/se05.cc +++ b/src/tgbaalgos/se05.cc @@ -469,7 +469,7 @@ namespace spot { assert(c != CYAN); int i = phc->erase(ps); - assert(i==1); + assert(i == 1); (void)i; ph->insert(std::make_pair(ps, c)); } @@ -480,7 +480,7 @@ namespace spot } bool is_white() const { - return !is_cyan && pc==0; + return !is_cyan && pc == 0; } private: bool is_cyan; @@ -515,19 +515,19 @@ namespace spot color_ref get_color_ref(const state*& s) { hcyan_type::iterator ic = hc.find(s); - if (ic==hc.end()) + if (ic == hc.end()) { hash_type::iterator it = h.find(s); - if (it==h.end()) + if (it == h.end()) return color_ref(0); // white state - if (s!=it->first) + if (s != it->first) { s->destroy(); s = it->first; } - return color_ref(&(it->second)); // blue or red state + return color_ref(&it->second); // blue or red state } - if (s!=*ic) + if (s != *ic) { s->destroy(); s = *ic; @@ -537,7 +537,7 @@ namespace spot void add_new_state(const state* s, color c) { - assert(hc.find(s)==hc.end() && h.find(s)==h.end()); + assert(hc.find(s) == hc.end() && h.find(s) == h.end()); if (c == CYAN) hc.insert(s); else @@ -599,17 +599,17 @@ namespace spot } void set_color(color c) { - if (is_cyan && c!=CYAN) + if (is_cyan && c != CYAN) { int i = phc->erase(ps); - assert(i==1); + assert(i == 1); (void)i; } *b = (*b & ~(3U << o)) | (c << o); } bool is_white() const { - return get_color()==WHITE; + return get_color() == WHITE; } private: bool is_cyan; @@ -634,7 +634,7 @@ namespace spot { size_t ha = s->hash(); hcyan_type::iterator ic = hc.find(s); - if (ic!=hc.end()) + if (ic != hc.end()) return color_ref(&hc, *ic, &h[ha%size_], ha%4); return color_ref(&h[ha%size_], ha%4); } @@ -642,7 +642,7 @@ namespace spot void add_new_state(const state* s, color c) { assert(get_color_ref(s).is_white()); - if (c==CYAN) + if (c == CYAN) hc.insert(s); else { diff --git a/src/tgbaalgos/tau03.cc b/src/tgbaalgos/tau03.cc index fd633bc54..9ed5bf7b5 100644 --- a/src/tgbaalgos/tau03.cc +++ b/src/tgbaalgos/tau03.cc @@ -337,19 +337,19 @@ namespace spot color_ref get_color_ref(const state*& s) { hash_type::iterator it = h.find(s); - if (it==h.end()) + if (it == h.end()) return color_ref(0, 0); - if (s!=it->first) + if (s != it->first) { s->destroy(); s = it->first; } - return color_ref(&(it->second.first), &(it->second.second)); + return color_ref(&it->second.first, &it->second.second); } void add_new_state(const state* s, color c) { - assert(h.find(s)==h.end()); + assert(h.find(s) == h.end()); h.insert(std::make_pair(s, std::make_pair(c, bddfalse))); } diff --git a/src/tgbaalgos/tau03opt.cc b/src/tgbaalgos/tau03opt.cc index d5be226c8..1546f3431 100644 --- a/src/tgbaalgos/tau03opt.cc +++ b/src/tgbaalgos/tau03opt.cc @@ -450,7 +450,7 @@ namespace spot assert(p.second); acc = &(p.first->second.second); int i = phc->erase(ps); - assert(i==1); + assert(i == 1); (void)i; } else @@ -508,33 +508,33 @@ namespace spot color_ref get_color_ref(const state*& s) { hcyan_type::iterator ic = hc.find(s); - if (ic==hc.end()) + if (ic == hc.end()) { hash_type::iterator it = h.find(s); - if (it==h.end()) + if (it == h.end()) // white state return color_ref(0, 0); - if (s!=it->first) + if (s != it->first) { s->destroy(); s = it->first; } // blue or red state - return color_ref(&(it->second.first), &(it->second.second)); + return color_ref(&it->second.first, &it->second.second); } - if (s!=ic->first) + if (s != ic->first) { s->destroy(); s = ic->first; } // cyan state return color_ref(&h, &hc, ic->first, - &(ic->second.first), &(ic->second.second)); + &ic->second.first, &ic->second.second); } void add_new_state(const state* s, color c, const weight& w) { - assert(hc.find(s)==hc.end() && h.find(s)==h.end()); + assert(hc.find(s) == hc.end() && h.find(s) == h.end()); assert(c == CYAN); (void)c; hc.insert(std::make_pair(s, std::make_pair(w, bddfalse)));