From: Brian Norris Date: Thu, 12 Jul 2012 18:04:58 +0000 (-0700) Subject: model: factor out 'tid' calculation X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=2402e5837208604d0926053cde5db51ac0f0853f;p=c11tester.git model: factor out 'tid' calculation --- diff --git a/model.cc b/model.cc index 41e4421c..e5791057 100644 --- a/model.cc +++ b/model.cc @@ -283,14 +283,15 @@ void ModelChecker::check_current_action(void) */ void ModelChecker::add_action_to_lists(ModelAction *act) { + int tid = id_to_int(act->get_tid()); action_trace->push_back(act); std::vector *vec = &(*obj_thrd_map)[act->get_location()]; - if (id_to_int(act->get_tid()) >= (int)vec->size()) + if (tid >= (int)vec->size()) vec->resize(next_thread_id); - (*vec)[id_to_int(act->get_tid())].push_back(act); + (*vec)[tid].push_back(act); - (*thrd_last_action)[id_to_int(act->get_tid())] = act; + (*thrd_last_action)[tid] = act; } ModelAction * ModelChecker::get_last_action(thread_id_t tid)