From 8b3bfaacdb8718b908fcb656729e1258cd1efcb5 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Mon, 27 Sep 2004 14:57:37 +0000 Subject: [PATCH] * src/sanity/style.test: Suggest using "x->y", not "(*x).y". * src/tgbaalgos/tarjan_on_fly.cc: Fix. --- ChangeLog | 5 +++++ src/sanity/style.test | 3 +++ src/tgbaalgos/tarjan_on_fly.cc | 18 ++++++++---------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index e37276e54..4508369db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-09-27 Alexandre Duret-Lutz + + * src/sanity/style.test: Suggest using "x->y", not "(*x).y". + * src/tgbaalgos/tarjan_on_fly.cc: Fix. + 2004-09-23 Alexandre Duret-Lutz * src/sanity/style.test: Suggest ++i over i++ when it does not diff --git a/src/sanity/style.test b/src/sanity/style.test index 5f561d232..50fd31083 100755 --- a/src/sanity/style.test +++ b/src/sanity/style.test @@ -125,6 +125,9 @@ for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do egrep '^[^=]*([+][+]|--);' $tmp && diag 'Take good habits: use ++i instead of i++ when you have the choice.' + grep '[^a-zA-Z0-9_](\*[a-zA-Z0-9_]*)\.' $tmp && + diag 'Use "x->y", not "(*x).y"' + case $file in *.hh | *.hxx) if egrep '(cout|cerr|clog)' $tmp >/dev/null; then diff --git a/src/tgbaalgos/tarjan_on_fly.cc b/src/tgbaalgos/tarjan_on_fly.cc index 792dceeae..a6271930f 100644 --- a/src/tgbaalgos/tarjan_on_fly.cc +++ b/src/tgbaalgos/tarjan_on_fly.cc @@ -35,13 +35,11 @@ namespace spot for (stack_type::iterator i = stack.begin(); i != stack.end(); ++i) { - //if ((*i).s) hash_type::iterator hi = h.find(i->s); if (hi != h.end()) h.erase(hi); - delete (*i).s; - //if ((*i).lasttr) - delete (*i).lasttr; + delete i->s; + delete i->lasttr; } for (hash_type::iterator i = h.begin(); @@ -195,7 +193,7 @@ namespace spot stack_type::const_iterator i; for (i = stack.begin(); i != stack.end(); ++i, ++n) - if (s->compare((*i).s) == 0) + if (s->compare(i->s) == 0) break; if (i == stack.end()) @@ -212,17 +210,17 @@ namespace spot stack_type::iterator i; for (i = stack.begin(); i != stack.end(); ++i) { - if (x && x->compare((*i).s) == 0) + if (x && x->compare(i->s) == 0) break; - ce->prefix.push_back(ce::state_ce((*i).s->clone(), - (*i).lasttr->current_condition())); + ce->prefix.push_back(ce::state_ce(i->s->clone(), + i->lasttr->current_condition())); } for (; i != stack.end(); ++i) { - ce->cycle.push_back(ce::state_ce((*i).s->clone(), - (*i).lasttr->current_condition())); + ce->cycle.push_back(ce::state_ce(i->s->clone(), + i->lasttr->current_condition())); } return ce;