From 95cc50da513fdb7531d7b55df47fd8358a20b52f Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Wed, 26 Jan 2011 11:01:00 +0100 Subject: [PATCH] Update gspn interface for recent tools. * iface/gspn/ssp.cc: Use the new destroy() interface, and fix a couple of recent g++ reports. * iface/gspn/gspn.cc: Adjust to newer g++. --- ChangeLog | 8 ++++++++ iface/gspn/gspn.cc | 7 +++++-- iface/gspn/ssp.cc | 34 ++++++++++++++++++---------------- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0de9e43ac..f9aba2639 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-01-26 Alexandre Duret-Lutz + + Update gspn interface for recent tools. + + * iface/gspn/ssp.cc: Use the new destroy() interface, and + fix a couple of recent g++ reports. + * iface/gspn/gspn.cc: Adjust to newer g++. + 2011-01-25 Alexandre Duret-Lutz Introduce a destroy() method on states, and use it instead of delete. diff --git a/iface/gspn/gspn.cc b/iface/gspn/gspn.cc index faee0d205..2fea20c1c 100644 --- a/iface/gspn/gspn.cc +++ b/iface/gspn/gspn.cc @@ -1,3 +1,5 @@ +// Copyright (C) 2011 Laboratoire de Recherche et Développement +// de l'Epita (LRDE). // Copyright (C) 2003, 2004, 2006, 2007 Laboratoire d'Informatique de // Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), // Université Pierre et Marie Curie. @@ -21,6 +23,7 @@ #include #include +#include #include "gspn.hh" #include @@ -382,11 +385,11 @@ namespace spot } tgba_succ_iterator* - tgba_gspn::succ_iter(const state* state, + tgba_gspn::succ_iter(const state* local_state, const state* global_state, const tgba* global_automaton) const { - const state_gspn* s = dynamic_cast(state); + const state_gspn* s = dynamic_cast(local_state); assert(s); (void) global_state; (void) global_automaton; diff --git a/iface/gspn/ssp.cc b/iface/gspn/ssp.cc index dd41b701d..db0c062f5 100644 --- a/iface/gspn/ssp.cc +++ b/iface/gspn/ssp.cc @@ -1,4 +1,6 @@ -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Laboratoire +// Copyright (C) 2008, 2011 Laboratoire de Recherche et Developpement +// de l'Epita (LRDE). +// Copyright (C) 2003, 2004, 2005, 2006, 2007 Laboratoire // d'Informatique de Paris 6 (LIP6), département Systèmes Répartis // Coopératifs (SRC), Université Pierre et Marie Curie. // @@ -66,7 +68,7 @@ namespace spot virtual ~state_gspn_ssp() { - delete right_; + right_->destroy(); } virtual int @@ -84,8 +86,8 @@ namespace spot virtual size_t hash() const { - return (reinterpret_cast(left()) - - static_cast(0)) << 10 + right_->hash(); + return ((reinterpret_cast(left()) + - static_cast(0)) << 10) + right_->hash(); } virtual state_gspn_ssp* clone() const @@ -200,7 +202,7 @@ namespace spot { for (size_t i = 0; i < size_states_; i++) - delete state_array_[i]; + state_array_[i]->destroy(); delete[] bdd_array_; free(state_array_); @@ -582,9 +584,9 @@ namespace spot virtual const state* has_state(const state* s) const { - set_type::iterator i; + set_type::const_iterator i; - for (i = states.begin(); i !=states.end(); i++) + for (i = states.begin(); i != states.end(); ++i) { const state_gspn_ssp* old_state = (const state_gspn_ssp*)(*i); const state_gspn_ssp* new_state = (const state_gspn_ssp*)(s); @@ -595,7 +597,7 @@ namespace spot if (spot_inclusion(new_state->left(), old_state->left())) { if (*i != s) - delete s; + s->destroy(); return *i; } } @@ -672,7 +674,7 @@ namespace spot // Advance the iterator before deleting the key. const state* s = i->first; ++i; - delete s; + s->destroy(); } } @@ -714,7 +716,7 @@ namespace spot { if (s != *j) { - delete s; + s->destroy(); s = *j; } } @@ -789,7 +791,7 @@ namespace spot { if (s != *j) { - delete s; + s->destroy(); s = *j; } } @@ -842,7 +844,7 @@ namespace spot res.second = i->second; if (s != i->first) - delete s; + s->destroy(); } return res; } @@ -863,7 +865,7 @@ namespace spot res.second = &i->second; if (s != i->first) - delete s; + s->destroy(); } return res; } @@ -1165,13 +1167,13 @@ namespace spot // s is not equal to another known // state. (We risk some intricate // memory corruption if we don't - // delete "clone states" at this + // destroy "clone states" at this // point.) // Since we have that first loop and // we therefore know that state s is // genuinely new, position j so that - // we won't delete it. + // we won't destroy it. j = l.end(); } else @@ -1213,7 +1215,7 @@ namespace spot { if (s != *j) { - delete s; + s->destroy(); s = *j; } }