nodestack: refactor Node constructor
authorBrian Norris <banorris@uci.edu>
Wed, 19 Dec 2012 06:18:03 +0000 (22:18 -0800)
committerBrian Norris <banorris@uci.edu>
Wed, 19 Dec 2012 06:18:54 +0000 (22:18 -0800)
nodestack.cc

index d4c97652b3c08084d3b08be614638dd054f54913..088fad8904b473aa603b457b188e6c9644cdd248 100644 (file)
@@ -41,13 +41,13 @@ Node::Node(ModelAction *act, Node *par, int nthreads, Node *prevfairness)
        ASSERT(act);
        act->set_node(this);
        int currtid = id_to_int(act->get_tid());
-       int prevtid = (prevfairness != NULL) ? id_to_int(prevfairness->action->get_tid()) : 0;
+       int prevtid = prevfairness ? id_to_int(prevfairness->action->get_tid()) : 0;
 
        if (model->params.fairwindow != 0) {
-               for (int i = 0; i < nthreads; i++) {
+               for (int i = 0; i < num_threads; i++) {
                        ASSERT(i < ((int)fairness.size()));
                        struct fairness_info *fi = &fairness[i];
-                       struct fairness_info *prevfi = (par != NULL) && (i < par->get_num_threads()) ? &par->fairness[i] : NULL;
+                       struct fairness_info *prevfi = (parent && i < parent->get_num_threads()) ? &parent->fairness[i] : NULL;
                        if (prevfi) {
                                *fi = *prevfi;
                        }