From f2a014110185c734180545ffc1dc2f0dcd30fd0c Mon Sep 17 00:00:00 2001
From: Brian Norris <banorris@uci.edu>
Date: Tue, 11 Sep 2012 12:24:15 -0700
Subject: [PATCH] model: replace action conditions with switch block

---
 model.cc | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/model.cc b/model.cc
index 90c7ad9..ba239b9 100644
--- a/model.cc
+++ b/model.cc
@@ -307,28 +307,37 @@ Thread * ModelChecker::check_current_action(ModelAction *curr)
 		}
 	}
 
-	/* Assign 'creation' parent */
-	if (curr->get_type() == THREAD_CREATE) {
+	/* Thread specific actions */
+	switch(curr->get_type()) {
+	case THREAD_CREATE: {
 		Thread *th = (Thread *)curr->get_location();
 		th->set_creation(curr);
-	} else if (curr->get_type() == THREAD_JOIN) {
+		break;
+	}
+	case THREAD_JOIN: {
 		Thread *wait, *join;
 		wait = get_thread(curr->get_tid());
 		join = (Thread *)curr->get_location();
 		if (!join->is_complete())
 			scheduler->wait(wait, join);
-	} else if (curr->get_type() == THREAD_FINISH) {
+		break;
+	}
+	case THREAD_FINISH: {
 		Thread *th = get_thread(curr->get_tid());
 		while (!th->wait_list_empty()) {
 			Thread *wake = th->pop_wait_list();
 			scheduler->wake(wake);
 		}
 		th->complete();
+		break;
 	}
-
-	/* Deal with new thread */
-	if (curr->get_type() == THREAD_START)
+	case THREAD_START: {
 		check_promises(NULL, curr->get_cv());
+		break;
+	}
+	default:
+		break;
+	}
 
 	/* Assign reads_from values */
 	Thread *th = get_thread(curr->get_tid());
-- 
2.34.1